def countSuccess(L, diff, hero) :

    """
    Counts the number of success for the roll.

    Parameters
    ----------
    L: int list
        Decreasing sorted list with values between 1 and 10.
    diff : int
        Difficulty of the roll. A dice is counted as a success if the value of the dice is greater or equal to the difficulty.
    hero : optional bool
        If the character is a hero, its 10 count two success instead of one, but are cancelled first by a critical failure (a one on another dice).
    """

    success = 0
    for val in L :
        if val == 1 :
            success -= 1
        elif val == 10 :
            if hero :
                success += 2
            else :
                success += 1
        elif val >= diff :
            success += 1
    return success