local n = io.read("*n")
a = {}
local sum = 0
for i = 1, n do
    local k = io.read("*n")
    a[i] = k
    sum = sum + k
end
table.sort(a, function(x, y) return x > y end)
local alice = 0
for i = 1, n, 2 do
    alice = alice + a[i]
end
print(alice * 2 - sum)