def count_steps(path):
    """Count the number of replacement steps in a given path

    :param path: the path through the CYK table
    :return steps: the number of replacement steps
    """
    # path is always a branching of the form
    # (a, (b, c))
    # standing for a => (b, c)
    name, result = path
    steps = 1  # count the branching that `path` stands for
    # add all sub-branchings
    for x in result:
        if not isinstance(x, str):
            steps += count_steps(x)

    return steps