n=int(eval(input()))

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

a.sort(reverse=True)

a.append(0)

Ali,Bob=0,0

for i in range(0,n,2):

    Ali +=a[i]

    Bob +=a[i+1]

print((Ali-Bob))
n=int(eval(input()))

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

a.sort(reverse=True)

Ali,Bob=0,0

for i in range(n):

    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)
a.append(0)
Ali, Bob = 0, 0
for i in range(0, n, 2):
    Ali += a[i]
    Bob += a[i + 1]
print((Ali - Bob))

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

-a.append(0) -for i in range(0, n, 2): -    Ali += a[i] -    Bob += a[i + 1] +for i in range(n): +    if i % 2 == 0: +        Ali += a[i] +    else: +        Bob += a[i]