Module Module1

    Sub Main()
        'let'
        Dim N As Long = Console.ReadLine()
        Dim tmp() As String = Console.ReadLine().Split()
        Dim a(N - 1) As Long

        For i As Long = 0 To N - 1
            a(i) = tmp(i)
        Next

        Array.Sort(a)
        Array.Reverse(a)

        'var'
        Dim ans As Long = 0

        For i As Long = 0 To N - 1
            ans += New Long() {-1, 1}(i Mod 2) * a(i)
        Next

        Console.WriteLine(Math.Abs(ans))

    End Sub

End Module