n=int(eval(input()))

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

ali=0

bob=0

a.sort(reverse=True)

for i in range(len(a)):

    if i%2==0:

        ali+=a[i]

    else:

        bob+=a[i]

print((ali-bob))
n=int(eval(input()))

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

a.sort(reverse=True)

alice=sum(a[::2]) 



bob=sum(a[1::2])

print((alice-bob))
n = int(eval(input()))
a = list(map(int, input().split()))
ali = 0
bob = 0
a.sort(reverse=True)
for i in range(len(a)):
    if i % 2 == 0:
        ali += a[i]
    else:
        bob += a[i]
print((ali - bob))

n = int(eval(input()))
a = list(map(int, input().split()))
a.sort(reverse=True)
alice = sum(a[::2])
bob = sum(a[1::2])
print((alice - bob))

-ali = 0 -bob = 0 -for i in range(len(a)): -    if i % 2 == 0: -        ali += a[i] -    else: -        bob += a[i] -print((ali - bob)) +alice = sum(a[::2]) +bob = sum(a[1::2]) +print((alice - bob))