LearnPy Hub
← Arena
AdvancedRating 1500

Ones From 0 to N

Print the total number of 1 bits in the binary forms of all integers from 0 to n.

Input

One integer n (0 ≤ n ≤ 10¹⁸).

Output

A count.

Sample 1

Input
5
Output
7

Sample 2

Input
0
Output
0
solution.py
Output appears here
Ones From 0 to N · Python Arena problem · LearnPy Hub