Module Module1

    Sub Main()
        'let'
        Dim N As Long = Console.ReadLine()
        Dim a() As Long =
            Array.ConvertAll(Of String, Long) _
            (Console.ReadLine.Split(), AddressOf Long.Parse)

        Array.Sort(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