October 9 - BMTK Programming School, High League
There are two boxes. There are a balls in the first box, and b balls in the second box (0 < a + b < 2147483648). It is possible to move balls from one box to another. From one box into another one should move as many balls as the other box already contains. You have to determine, whether it is possible to move all balls into one box.
Each line contains two integers a and b, delimited by space.
For each test case print in a separate line the number of moves which are required to move all balls into one box, or -1 if it is impossible.
2 6 8 12 7 9
2 -1 4