Binary number
Planet Shelezyaka ... Minerals on the planet do not. The waters are not. The atmosphere there. Nothing on the planet do not. If that was all spent, and robots are living in poverty.
Cyrus Bulychev "Alice's Journey"
As you know, the planet Shelezyaka located in a remote part of our galaxy, away from the space trails. Water robots (the only inhabitants of the planet in the second half of the 21st century) specifically eliminated so as not to rust (they feared heavy rains and floods). In this regard, the planet was determined to anybody except the robot is not needed.
Once on the desert planet pirates arrived. That was a real mother villains. Their heart was unknown to pity. They captured almost all the robots and took them to far-distant galaxy and forced to work in the mines on the planet Bendomir.
It was some time before they learned about it on Earth. Richard Tempest, fearless of the Institute of Time, went back in time to prevent the evil plans of the pirates. As it turned out, taking advantage of the hospitality of robots, pirates suggested robots to solve the puzzle on speed. However, the computational capabilities of robots are not great, and algorithms to optimize their performance was no one. Therefore, all that remained villains - load into the hold of the ship unfeeling robot body absorbed calculations.
Richard managed to find out what unsuccessfully fought electronic brains of robots. Pirates were offering them a non-negative integer n. After that they asked to see what happens with that number if it n times to apply the operation: take the high bit in the binary number and put it in the end. For example, if a time to apply this operation to the number 14_10=1110_2, you get 13_10=1101_2. After reapplying get 11_10=1011_2.
Richard whistled. If he can get a program that quickly solves this problem, he can go in the days before the arrival of pirates and robots to get this program so that they can resist the evil pirates.
You - Fellow of the Institute of Time tasked to urgently write this program. Help save the robots.
Input
One integer n (0 ≤ n ≤ 10^18).
Output
Print the answer to the problem posed by pirates to robots.