import numpy as np

import sys

n = int(eval(input()))

a = sorted(list(map(int,input().split())))[::-1]

print((sum(a[::2])-sum(a[1::2])))

n=int(eval(input()))

a=sorted(list(map(int,input().split())))[::-1]

ans=0

for i in range(n):

    if i%2==0:

        ans+=a[i]

    else:

        ans-=a[i]

print(ans)

import numpy as np
import sys

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

n = int(eval(input()))
a = sorted(list(map(int, input().split())))[::-1]
ans = 0
for i in range(n):
    if i % 2 == 0:
        ans += a[i]
    else:
        ans -= a[i]
print(ans)

-import numpy as np -import sys - -print((sum(a[::2]) - sum(a[1::2]))) +ans = 0 +for i in range(n): +    if i % 2 == 0: +        ans += a[i] +    else: +        ans -= a[i] +print(ans)