Imports System

Public Class Program

    Public Shared Sub Main()

        Dim N As Integer = Integer.Parse(Console.ReadLine())
        Dim InputString() As String = Console.ReadLine().Split(" ")
        Dim InputInteger(N - 1) As Integer

        For i As Integer = 0 To N - 1

            InputInteger(i) = Integer.Parse(InputString(i))

        Next

        Array.Sort(Of Integer)(InputInteger)

        Dim dif As Integer = 0

        For i As Integer = N - 1 To 0 Step -2
            dif = dif + InputInteger(i)
            If Not (i = 0) Then
                dif = dif - InputInteger(i - 1)
            End If

        Next



        Console.WriteLine(dif)

    End Sub
End Class
