单点时限: 10.0 sec
内存限制: 1024 MB
Farmer John has recently moved to EOJ Town so that he could buy beautiful (and delicious) cows. But soon, he found that prices of cows at EOJ Town increases at a ridiculous speed. Namely, when Farmer John arrived at EOJ Town, the cows sold $1$ dollar; on the second day, it became $2$ dollars; on the third day, it became $4$ dollars – the price doubles as time goes by! Soon the price became unacceptable to Farmer John, and he left EOJ Town, disappointed, as he could no longer even afford one cow with his salary.
Farmer John has a daily salary of $n$ dollars. He wants to know the total number of cows he can purchase during his stay. That is, if you don’t have the patience to read this short statement, the following formula:
$$\sum_{i=0}^{\infty} \lfloor \frac{n}{2^i} \rfloor$$
A positive integer $n$ ($1 \le n \le 10^{20~000}$).
4
7
16
31
64
127