Sequence#2798

Sequence

1 second
64 megabytes
Easy (≈1000)

Mathematicians often explore numerical sequences such as the Fibonacci numbers or powers of two, where each term is determined by a specific rule. But what if the pattern is not immediately obvious?

Find the -th term of the sequence: 3, 5, 6, 9, 10, 12, 17, 18, 20, 24, 33, \ldots

Input

A natural number (N \leq 2012).

Output

The -th term of the sequence.

Examples

Example 1

Loading
Loading