N = int(eval(input()))

A = [int(x) for x in input().split()]

A.sort()

a, b, turn = 0, 0, 1

while len(A) != 0:

    if turn & 1:

        a += A.pop()

    else:

        b += A.pop()

    turn += 1

print((a-b))
with open(0) as f:

    N, *A = list(map(int, f.read().split()))

A.sort(reverse=True)

Alice = sum(A[::2])

Bob = sum(A[1::2])

print((Alice - Bob))
N = int(eval(input()))
A = [int(x) for x in input().split()]
A.sort()
a, b, turn = 0, 0, 1
while len(A) != 0:
    if turn & 1:
        a += A.pop()
    else:
        b += A.pop()
    turn += 1
print((a - b))

with open(0) as f:
    N, *A = list(map(int, f.read().split()))
A.sort(reverse=True)
Alice = sum(A[::2])
Bob = sum(A[1::2])
print((Alice - Bob))

-N = int(eval(input())) -A = [int(x) for x in input().split()] -A.sort() -a, b, turn = 0, 0, 1 -while len(A) != 0: -    if turn & 1: -        a += A.pop() -    else: -        b += A.pop() -    turn += 1 -print((a - b)) +with open(0) as f: +    N, *A = list(map(int, f.read().split())) +A.sort(reverse=True) +Alice = sum(A[::2]) +Bob = sum(A[1::2]) +print((Alice - Bob))