Maximum minus minimum#10054

Maximum minus minimum

1 second
64 megabytes
Very easy

Given a positive integer , calculate the difference between the maximum and minimum values obtained by permuting the bits of this number, from the least significant bit to the most significant bit. For instance, consider the number , which has a binary representation of 10110_2. The maximum value from permutations of these bits is 11100_2 = 28, and the minimum value is 00111_2 = 7. Therefore, the difference is .

Input

The first line of the input contains the number (0 < N \leq 10^{18}).

Output

Output a single line with the result of the calculation.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading

Example 3

Loading
Loading