N = int(input())
l = [int(i) for i in input().split()]
l.sort(reverse=True)
alice = l[0::2]
bob = l[1::2]
print(sum(alice) - sum(bob))

225b6a8ca23deaed0bf878b0d661dd4cf8787f13
<mask token>

<mask token>
l.sort(reverse=True)
<mask token>
print(sum(alice) - sum(bob))

N = int(input())
l = [int(i) for i in input().split()]
l.sort(reverse=True)
alice = l[0::2]
bob = l[1::2]
print(sum(alice) - sum(bob))
