What is left?#1964

What is left?

5 seconds
512 megabytes
Medium

Everyone probably remembers a childhood riddle: A and B were sitting on a pipe. A fell, B disappeared. What is left on the pipe?

Vasya, Petya, and Dima play a similar game they invented. First, they wrote out the numbers from to in a row and noticed that the order of the number matches the number itself. Then they take turns making moves. First, the player removes all numbers in even positions from the sequence. Next, in the remaining sequence, after renumbering, the player removes all numbers in odd positions. Then, from the sequence remaining after the previous two operations, the player removes all numbers in positions divisible by . After that—they again remove numbers in even positions, then odd positions, then positions divisible by , and so on. This elimination process continues until only one number remains.

What is the last remaining number as a result of this game?

Input

The number of natural numbers (1 \leq n \leq 10^8) written on the playing field.

Output

Print the last remaining number after this game.

Examples

Example 1

Loading
Loading