n = int(eval(input()))

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



a.sort(reverse=True)



ans = sum(a[0::2]) - sum(a[1::2])



print(ans)

n = int(eval(input()))

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



a.sort()

a.reverse()

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

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

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

-a.sort(reverse=True) -ans = sum(a[0::2]) - sum(a[1::2]) -print(ans) +a.sort() +a.reverse() +print((sum(a[::2]) - sum(a[1::2])))