Code Submission Evaluation System Login

CSES Problem Set

Counting Bits


Task | Statistics


CSES - Counting Bits

Time limit:1.00 s Memory limit:512 MB

Your task is to count the number of one bits in integers between $1 \ldots n$.

Input

The only input line has an integer $n$.

Output

Print the number of one bits in integers between $1 \ldots n$.

Constraints
Example

Input:
7

Output:
12

Explanation: The bit representations of $1 \ldots 7$ are 1, 10, 11, 100, 101, 110, and 111, so there are a total of 12 one bits.