let N = stdin.ReadLine()

stdin.ReadLine().Split(' ') |> Array.map int
|> Array.sortDescending
|> Array.indexed
|> Array.partition (fun (id,x) -> id%2=0)
|> fun (arrAlice, arrBob) -> (Array.sumBy snd arrAlice) - (Array.sumBy snd arrBob)
|> printfn "%d"