def hamming_distance(x, y):
    """Calculate the hamming distance (number of bits different) between the
    two integers given.

    >>> [hamming_distance(x, 15) for x in [0, 8, 10, 12, 14, 15]]
    [4, 3, 2, 2, 1, 0]
    """
    return bin(x ^ y).count('1')
