def count_matches(list, item):
    """
    Return the number of occurrences of the given item in the given
    list.
    """
    if list == ():
        return 0
    else:
        head, tail = list
        if head == item:
            return 1 + count_matches(tail, item)
        else:
            return count_matches(tail, item)