Next number
Problem
Given a natural number N
. It is necessary to determine the number following it, in the binary decomposition of which there are as many units as in the binary decomposition of the number N
.
Input
The input contains a single natural number N
(\(N <= 2^{30}\)).
Output
Display the answer to the problem.
Examples
# |
Input |
Output |
1 |
1 |
2 |
2 |
2 |
4 |
3 |
3 |
5 |