# codineg: utf-8
n = int(input())
cards = list(map(int,input().split()))
# a,b,c,x = map(int, [input() for i in range(4)])
answer = 0
bob = 0
alice = 0

cards.sort(reverse=True)
for i in range(n):

    # print(i)    
    if i % 2 == 1:
        #bob
        # print("bob cards[i]=" + str(cards[i]))
        bob = bob + cards[i]
    else:
        # print("alice cards[i]=" + str(cards[i]))
        alice = alice + cards[i]
    
print(alice - bob)

3610dad37cfdf73b7daa4d27baba77c0bdeb394c
<mask token>

<mask token>
cards.sort(reverse=True)
for i in range(n):
    if i % 2 == 1:
        bob = bob + cards[i]
    else:
        alice = alice + cards[i]
print(alice - bob)

n = int(input())
cards = list(map(int, input().split()))
answer = 0
bob = 0
alice = 0
cards.sort(reverse=True)
for i in range(n):
    if i % 2 == 1:
        bob = bob + cards[i]
    else:
        alice = alice + cards[i]
print(alice - bob)

# codineg: utf-8
n = int(input())
cards = list(map(int,input().split()))
# a,b,c,x = map(int, [input() for i in range(4)])
answer = 0
bob = 0
alice = 0

cards.sort(reverse=True)
for i in range(n):

    # print(i)    
    if i % 2 == 1:
        #bob
        # print("bob cards[i]=" + str(cards[i]))
        bob = bob + cards[i]
    else:
        # print("alice cards[i]=" + str(cards[i]))
        alice = alice + cards[i]
    
print(alice - bob)
