def fusion(L1,L2):
    if L1 == []:
        return L2
    elif L2 == []:
        return L1
    elif L1[0] < L2[0]:
        return [L1[0]] + fusion(L1[1:],L2)
    else:
        return [L2[0]] + fusion(L1,L2[1:])

def tri(L):
    n = len(L)
    if n < 2:
        return L
    else:
        m = n // 2
        return fusion(tri(L[:m]),tri(L[m:]))