eolymp
bolt
Try our new interface for solving problems
Problems

Odd Divisors

Odd Divisors

Let $f(n)$ be the greatest odd divisor of $n$, where $n$ is a positive integer. You are given a positive integer $n$. Find the sum $f(1) + f(2) + ... + f(n)$. \InputFile Each line contains one positive integer $n~(n \le 10^9)$. \OutputFile For each value of $n$ print in a separate line the value of $f(1) + f(2) + ... + f(n)$.
Time limit 1 second
Memory limit 128 MiB
Input example #1
7
1
777
Output example #1
21
1
201537