H. Binary Palindromic Harmony
time limit per test
0.5 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output

Several quantum alternatives to traditional algorithms have been researched to solve a variety of problems. Using quantum logic gates, it is possible to gain performance in some specific types of tasks, leading to improvements, for example, in number factorization algorithms and data set searches.

Shor is working on a quantum algorithm for recognizing palindromes in binary sequences. To do this, he needs to generate a large number of examples, and he decided that he would need to know for a given positive integer $$$X$$$, what the largest integer $$$Y$$$ less than or equal to $$$X$$$ would be, whose binary representation is palindromic.

Shor has a lot of experience with quantum algorithms, but he is having difficulty creating a classical algorithm that solves this problem. Can you help?

Input

The only line of input contains the integer $$$X$$$ ($$$1 \leq X \leq 10^{18}$$$).

Output

Output a single line with the corresponding integer $$$Y$$$.

Examples
Input
9945
Output
9945
Input
11
Output
9
Input
154
Output
153