def count_clues(puzzle_grid):
    """Counts clues in a puzzle_grid, which can be a list of lists or string."""
    if isinstance(puzzle_grid, list):
        return sum([1 for sublist in puzzle_grid for i in sublist if i])
    return len(puzzle_grid) - puzzle_grid.count(".")