n = int(eval(input()))

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

Alice = 0

Bob = 0

ans = 0

while len(a) != 0:

    Alice += max(a)

    a.remove(max(a))

    if a:

        Bob += max(a)

        a.remove(max(a))

ans = Alice - Bob

print(ans)

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 = list(map(int, input().split()))
Alice = 0
Bob = 0
ans = 0
while len(a) != 0:
    Alice += max(a)
    a.remove(max(a))
    if a:
        Bob += max(a)
        a.remove(max(a))
ans = Alice - Bob
print(ans)

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

-a = list(map(int, input().split())) -Alice = 0 -Bob = 0 -ans = 0 -while len(a) != 0: -    Alice += max(a) -    a.remove(max(a)) -    if a: -        Bob += max(a) -        a.remove(max(a)) -ans = Alice - Bob -print(ans) +a = sorted(list(map(int, input().split())), reverse=True) +print((sum(a[::2]) - sum(a[1::2])))