def count_trees(tree_map, down, right):
    """Count number of trees encountered in tree_map, with down, right steps."""
    column = 0
    trees = 0
    for index, row in enumerate(tree_map[::down]):
        if row[column] == '#':
            trees += 1
        column = (column + right) % len(row)
    return trees