

Module Module1

sub Main(ByVal args() as String)
    dim N as integer = Console.ReadLine()
    dim arr() as string = Split(Console.ReadLine())
    dim a(N) as integer
    for i as integer = 0 to N-1 step 1
        a(i) = arr(i)
    next i
    Array.Sort(a)
    Array.Reverse(a)

    dim sumAlice as integer = 0
    dim sumBob as integer = 0
    dim f as boolean = true
    for each i as integer in a
        if f then
            sumAlice += i
            f = false
        else    
            sumBob += i
            f = true
        end if
    next
    Console.WriteLine(sumAlice-sumBob)
end sub

end Module