e-olymp
Competitions

October 9 - BMTK Programming School, High League

Boxes

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.

Input

Each line contains two integers a and b, delimited by space.

Output

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.

Time limit 1 second
Memory limit 64 MiB
Input example
2 6
8 12
7 9
Output example
2
-1
4