n=int(eval(input()))

a=sorted(list(map(int,input().split())),reverse=True)

alice=sum(a[::2])

bob=sum(a[1::2])

print((alice-bob))
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 = sorted(list(map(int, input().split())), reverse=True)
alice = sum(a[::2])
bob = sum(a[1::2])
print((alice - bob))

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

-alice = sum(a[::2]) -bob = sum(a[1::2]) -print((alice - bob)) +print((sum(a[::2]) - sum(a[1::2])))