eolymp
bolt
Try our new interface for solving problems
Problems

Binary number

Binary number

\textit{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.} \textit{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 \textbf{21}st 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 \textbf{n}. After that they asked to see what happens with that number if it \textbf{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 \textbf{14_10=1110_2}, you get \textbf{13_10=1101_2}. After reapplying get \textbf{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. \InputFile One integer \textbf{n} (\textbf{0} ≤ \textbf{n} ≤ \textbf{10^18}). \OutputFile Print the answer to the problem posed by pirates to robots.
Time limit 1 second
Memory limit 64 MiB
Input example #1
0
Output example #1
0
Input example #2
14
Output example #2
7