Problem Statement

Given an integer A find the Ath number whose binary representation is a palindrome.

NOTE:

Problem Constraints

1 <= A <= 2104

Input Format

First and only argument is an integer A.

Output Format

Return an integer denoting the Ath number whose binary representation is a palindrome.

Example Input

Input 1: A = 1 Input 2: A = 9

Example Output

Output 1: 1 Output 2: 27 Example Explanation

Explanation 1:

 1st Number whose binary representation is palindrome is 1

Explanation 2

 9th Number whose binary representation is palindrome is 27 (11011)