eolymp
bolt
Try our new interface for solving problems
Problems

Saruman`s Level Up

Saruman`s Level Up

Time limit 1 second
Memory limit 64 MiB

Saruman's army of orcs and other dark minions continuously mine and harvest lumber out of the land surrounding his mighty tower for n continuous days. On day number i, Saruman either chooses to spend resources on mining coal and harvesting more lumber, or on raising the level (i.e., height) of his tower. He levels up his tower by one unit only on days where the binary representation of i contains a total number of 1's that is an exact multiple of 3. Assume that the initial level of his tower on day 0 is zero.

For example, Saruman will level up his tower on day 7 (binary 111), next on day 11 (binary 1011) and then day 13, day 14, day 19, and so on.

Saruman would like to forecast the level of his tower after n days. Can you write a program to help?

Input data

Contains multiple test cases, each on a single line. Each test case consists of a positive integer n (n < 10^16), as described above.

Output data

For each test case, output one line: "Day n: Level = l", where n is the input n, and l is the number of levels after n days.

Examples

Input example #1
2
19
64
Output example #1
Day 2: Level = 0
Day 19: Level = 5
Day 64: Level = 21
Source 2012 North America - Pacific Northwest Region Programming Contest, November 3, Problem G