N = int(eval(input()))

l = list(map(int, input().split()))

l.sort(reverse=True)

print((sum([l[i] for i in range(0, len(l), 2)]) - sum([l[i] for i in range(1, len(l), 2)])))
N = int(eval(input()))

l = list(map(int, input().split()))

l.sort(reverse=True)

print((sum(l[0::2]) - sum(l[1::2])))
N = int(eval(input()))
l = list(map(int, input().split()))
l.sort(reverse=True)
print(
    (
        sum([l[i] for i in range(0, len(l), 2)])
        - sum([l[i] for i in range(1, len(l), 2)])
    )
)

N = int(eval(input()))
l = list(map(int, input().split()))
l.sort(reverse=True)
print((sum(l[0::2]) - sum(l[1::2])))

-print( -    ( -        sum([l[i] for i in range(0, len(l), 2)]) -        - sum([l[i] for i in range(1, len(l), 2)]) -    ) -) +print((sum(l[0::2]) - sum(l[1::2])))