```
class Solution(object):
def hammingDistance(self, x, y):
"""
:type x: int
:type y: int
:rtype: int
"""
result = 0
while (x > 0 or y > 0):
x_last, y_last = x % 2, y % 2
if (x_last != y_last):
result += 1
x //= 2
y //= 2
return result
```