#K65607. Minimum Bit Flips

    ID: 32235 Type: Default 1000ms 256MiB

Minimum Bit Flips

Minimum Bit Flips

Given two non-negative integers x and y, determine the minimum number of bit flips required to convert x to y.

The process essentially involves finding the number of differing bits between the binary representations of x and y. Mathematically, if we define the XOR operation between x and y as D = x \oplus y, then the answer is given by:

$$ answer = \sum_{i \ge 0} \mathbb{1}_{\{(D)_i = 1\}} $$

where \mathbb{1}_{\{(D)_i = 1\}} is 1 if the i-th bit of D is 1, and 0 otherwise.

You are required to read the input from standard input and output the result to standard output.

inputFormat

The input consists of a single line containing two non-negative integers x and y separated by a space.

For example:

5 9

outputFormat

Output a single integer, which is the minimum number of bit flips needed to convert x to y.

For example:

2
## sample
5 9
2