Joseph is given a positive integer N.
Convert the number N into its binary representation.
Toggle (flip) every bit starting from the Most Significant Bit (MSB) to the end.
Replace 1 with 0
Replace 0 with 1
Convert the resulting binary number back to decimal and print the result.
Test Case
Input
10
Output
5
Explanation
Decimal 10 in binary → 1010
After toggling all bits → 0101
Binary 0101 in decimal → 5
Therefore, the output is 5.