The planet Chapek 9 is located in a remote corner of our galaxy, far from the usual space routes. The robots (the only inhabitants of the planet in the second half of the st century) eliminated all water to protect themselves from rust (they were especially afraid of rain and floods). Thus, the planet was of no use to anyone except the robots themselves.
One day, pirates landed on the deserted planet. They were real villains; pity was unknown to their hearts. They captured almost all the robots, transported them to a faraway galaxy, and forced them to work in the mines on Planet Bendomir.
A long time passed before people on Earth discovered what had happened. Richard Tempest, a fearless employee of the Institute of Time, traveled back in time to prevent the pirates' evil plans. As it turned out, taking advantage of the robots' hospitality, the pirates offered them a puzzle to solve as a competition. However, the robots' computational abilities were limited, and they had no one to help optimize their algorithms. Therefore, all the villains had to do was load the unfeeling bodies of the robots, absorbed in computation, into the ship's hold.
Richard managed to learn what the electronic brains of the robots had been struggling with. The pirates gave the robots a non-negative integer . They then asked the robots to determine what would happen to this number if the following operation was applied times:
Take the highest bit (the leftmost ) in the binary representation of the number and move it to the end (rightmost position).
For example:
If we apply the operation once to the number 14_{10} = 1110_2, the result is 13_{10} = 1101_2.
Applying it again yields 11_{10} = 1011_2.
Richard whistled. If he could write a program to quickly solve this problem, he could travel to the days before the pirates' arrival and provide the robots with this program, so they could stand up to the evil pirates.
You are a staff member of the Institute of Time, assigned to urgently write the required program. Help save the robots!
The input contains one integer (0 \leq n \leq 10^{18}).
Print the answer to the problem posed by the pirates.
Example 1
Example 2