def count(grid, c):
    """
    Count the occurrences
    of an object "c" in
    the 2D list "grid".
    """
    acc = 0
    for row in grid:
        for elem in row:
            acc += c == elem
    return acc