let N = stdin.ReadLine() |> int
let a = stdin.ReadLine().Split(' ') |> Array.map int |> Array.sort |> Array.rev

let sum_odd = Array.mapi (fun i v -> if i%2=0 then 0 else v) a |> Array.sum
let sum_even =  Array.sum a - sum_odd

printfn "%d" (sum_even - sum_odd)
