Nth Palindromic Binary

easy
1. You are given an integer N.
2. You have to find the N-th number whose binary representation is a palindrome.

Note -> First binary number whose representation is a palindrome is 1.

Input Format

A number N

Output Format

Check the sample output and question video.

Constraints

1 <= n <= 2*10^4

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
17
Output
85
Previous
Min Xor Pairs
Next
Is A Power Of 4

Related Questions