def problem_5_5(a, b):
    """ Write a function to determine the number of bits required to convert
    integer A to integer B.
    Input: 31, 14
    Output: 2

    Solution: compute (a XOR b) and produce the number of 1 bits in the result.
    """
    def num_set_bits(n):
        count = 0
        while n != 0:
            last_bit = n & 1
            if last_bit == 1:
                count += 1
            n = n >> 1
        return count

    return num_set_bits(a ^ b)