Read an integer variable, and determine the smallest positive integer that has the same number of s in its bit representation as the number you read.
The following numbers all have the same number of s in their bit representation: 7 (), 13 (), 37 (), etc. And among all such positive integers, 7 is the smallest number that has 3 s in its bit representation.
The input will contain an integer ().
Print the smallest positive integer that has the same number of s in its bit representation as .
Input | Output |
---|---|
37 | 7 |