n=int(eval(input()))

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

a.sort(reverse=True)

pt=0

for i in a[::2]:

  pt+=i

for i in a[1::2]:

  pt-=i

print(pt)
n=int(eval(input()))

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

a.sort(reverse=True)

print((sum(a[::2])-sum(a[1::2])))
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort(reverse=True)
pt = 0
for i in a[::2]:
    pt += i
for i in a[1::2]:
    pt -= i
print(pt)

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

-pt = 0 -for i in a[::2]: -    pt += i -for i in a[1::2]: -    pt -= i -print(pt) +print((sum(a[::2]) - sum(a[1::2])))