import itertools


def perm_parity(input_list):
    """
    Determines the parity of the permutation required to sort the list.
    Outputs 0 (even) or 1 (odd).
    """
    
    parity = 0
    for i, j in itertools.combinations(range(len(input_list)), 2):
        if input_list[i] > input_list[j]:
            parity += 1
    
    return parity % 2