Jinhong likes numbers. While playing with them today he worked out the bit friendship index of two numbers.
The bit friendship index of two binary numbers is the smallest number of operations needed to make them equal. Two operations are allowed.
- In one of the two binary numbers, change the digit at any position to 0 or 1.
- In one of the two binary numbers, swap the digits at two different positions.
For example, take the decimal numbers 11 and 12. In binary they are 1011 and 1100. Changing the digit in the 2s place of 1011 to 0 gives 1001, and swapping the digit in the 1s place with the digit in the 4s place then gives 1100. Two operations are enough and no shorter sequence exists, so the bit friendship index of 11 and 12 is 2.
Jinhong wants a program that takes two numbers and reports their bit friendship index. He is weak at programming and can only convert a decimal number to binary. Help him and write that program.