def sign(l):
    """
    :param l: ordered list of indices
    :type l: list (or similar)
    :return: sign of l

    Compute the sign of an ordered list (-1 for each flip needed to get to ascending order)
    """
    res = 1
    for i in range(len(l)):
        for j in range(i + 1, len(l)):
            if l[i] > l[j]: res *= -1
    return res