n = int(eval(input()))

A = sorted(list(map(int, input().split())), reverse=True)

alc = 0

bb = 0

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

    alc += A[i]

for j in range(1, n, 2):

    bb += A[j]

print((alc - bb))
n = int(eval(input()))

A = sorted(list(map(int, input().split())), reverse=True)

print((sum(A[::2]) - sum(A[1::2])))
n = int(eval(input()))
A = sorted(list(map(int, input().split())), reverse=True)
alc = 0
bb = 0
for i in range(0, n, 2):
    alc += A[i]
for j in range(1, n, 2):
    bb += A[j]
print((alc - bb))

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

-alc = 0 -bb = 0 -for i in range(0, n, 2): -    alc += A[i] -for j in range(1, n, 2): -    bb += A[j] -print((alc - bb)) +print((sum(A[::2]) - sum(A[1::2])))