XOR would give the differences. Then just count the number of bits which are set

```
def hammingDistance(self, x, y):
"""
:type x: int
:type y: int
:rtype: int
"""
xor_val = x ^ y
count = 0
while xor_val:
xor_val = xor_val & (xor_val - 1)
count += 1
return count
```