Game
Easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
There is a pile with N stones and 2 players. They plays by turns. In his turn the player must divide a pile into two unequal parts and take away smaller one. If it is impossible to do it, the player loses.
How many stones would you take if you expect to win the game, when you play as first player, or 0, if you lose?
Input
The number of stones in the pile N (1 ≤ N ≤ 10000).
Output
Number of stones taken by you in the first turn, or 0 if you can't win the game.
Examples
Input #1
Answer #1
Submissions 7K
Acceptance rate 26%