beecrowd | 2289

Hamming Distance

By Francisco Elio Parente Arcos Filho, UEA BR Brazil

Timelimit: 1

In information theory, the Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. In another way, it measures the minimum number of substitutions required to change one string into the other, or the minimum number of errors that could have transformed one string into the other.

The Hamming distance is named after Richard Hamming, who introduced it in his fundamental paper on Hamming codes Error detecting and error correcting codes in 1950.

It is used in telecommunication to count the number of flipped bits in a fixed-length binary word as an estimate of error, and therefore is sometimes called the signal distance. Hamming weight analysis of bits is used in several disciplines including information theory, coding theory, and cryptography.

For example , the binary representation of 910 is 10012 and 1010 is 10102 therefore distance Hamming between them is 2 because you only need to switch the last two bits 10012 to turn in 10102.

Your task is , given two positive integers , calculate the Hamming distance between them.

Input

The input consists of several test cases . Each test case is composed of two positive integers in decimal base X and Y (0 ≤ X, Y < 264) provided on a single line. The input ends when X=Y=0.

Output

The output has a line per test case containing the Hamming distance of binary representations of X and Y.

Input Sample Output Sample

9 10

6 9

7 15

0 0

2

4

1