#5559. CSES1146 统计位数

0

CSES1146 统计位数

Counting Bits

Your task is to count the number of one bits in the binary representations of integers between 1 and n.

Input

The only input line has an integer n.

Output

Print the number of one bits in the binary representations of integers between 1 and n.

Constraints

1n101 \le n \le 10^{15}$

Example

Input

7

Output

12

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