CSCI 499 Sp18 Set I


2018-01-11 08:00 CET

CSCI 499 Sp18 Set I


2018-01-17 23:00 CET
The end is near!
Contest is over.
Not yet started.
Contest is starting in -65 days 11:19:26

Time elapsed


Time remaining


Problem C
Reversed Binary Numbers

Yi has moved to Sweden and now goes to school here. The first years of schooling she got in China, and the curricula do not match completely in the two countries. Yi likes mathematics, but now... The teacher explains the algorithm for subtraction on the board, and Yi is bored. Maybe it is possible to perform the same calculations on the numbers corresponding to the reversed binary representations of the numbers on the board? Yi dreams away and starts constructing a program that reverses the binary representation, in her mind. As soon as the lecture ends, she will go home and write it on her computer.


Your task will be to write a program for reversing numbers in binary. For instance, the binary representation of 13 is 1101, and reversing it gives 1011, which corresponds to number 11.


The input contains a single line with an integer $N$, $1 \leq N \leq 1\; 000\; 000\; 000$.


Output one line with one integer, the number we get by reversing the binary representation of $N$.

Sample Input 1 Sample Output 1
Sample Input 2 Sample Output 2