alice=0

bob=0

n=int(eval(input()))

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

def delete():

    del a[a.index(Max)]

while n>=1:

    Max=max(a)

    alice=alice+Max

    n=n-1

    delete()

    if n>=1:

        Max=max(a)

        bob=bob+Max

        n=n-1

        delete()

else:

    print((alice-bob))



n = eval(input())

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

a.sort(reverse=True)

print((sum(a[::2]) - sum(a[1::2])))
alice = 0
bob = 0
n = int(eval(input()))
a = list(map(int, input().split()))


def delete():
    del a[a.index(Max)]


while n >= 1:
    Max = max(a)
    alice = alice + Max
    n = n - 1
    delete()
    if n >= 1:
        Max = max(a)
        bob = bob + Max
        n = n - 1
        delete()
else:
    print((alice - bob))

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

-alice = 0 -bob = 0 -n = int(eval(input())) +n = eval(input()) - - -def delete(): -    del a[a.index(Max)] - - -while n >= 1: -    Max = max(a) -    alice = alice + Max -    n = n - 1 -    delete() -    if n >= 1: -        Max = max(a) -        bob = bob + Max -        n = n - 1 -        delete() -else: -    print((alice - bob)) +a.sort(reverse=True) +print((sum(a[::2]) - sum(a[1::2])))