Meth 3 Flipping Spree

Krish is being a maniac and flipping everyone's binder!

Today, he is even more crazy and decides to come to school early so he can steal binders and flip them for fun.

He takes N binders (1 < N <= 10^12) and arranges them in a single line on the floor.

Then he walks all the way to the end of the hall flipping every second binder.

After that he walks back to the starting point and, on the way, flips every second binder that has not been flipped.

He does this until there is one binder left and then opens the binder to copy their baguette drawings:(

Given N, can you find out which unlucky lad had his baguette copied?


Input Specification


The first line will contain N, the number of binders


Output Specification


In one line, output the position of the binder which Krish copies baguette from


Sample Input


15


Sample Output


11


Explanation: https://cdn.discordapp.com/attachments/628361107370803250/693270980524769420/unknown.png

Comments