eolymp
Competitions

Виток 1, Шаг 8 - Битовые операции

Binary number

PlanetShelezyaka...Mineralson the planetdo not.The watersare not.The atmospherethere.Nothingon the planetdo not.Ifthatwasallspent, androbotsare livingin poverty.

CyrusBulychev"Alice'sJourney"

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 number1410=11102, you get1310=11012. After reapplying get1110=10112.

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 integern (0n1018).

Output

Print the answer to theproblem posedby piratestorobots.

Time limit 1 second
Memory limit 64 MiB
Input example #1
0
Output example #1
0