// AtCoder My Practice
// author: Leonardone @ NEETSDKASU

[<EntryPoint>]
let main _ =
    let _ = stdin.ReadLine()
    let ans =
        stdin.ReadLine().Split(' ')
        |> Array.map int
        |> Array.sort
        |> Array.mapi (fun i x -> 
            if i % 2 = 0 then x else -x
            )
        |> Array.sum
        |> abs
    printfn "%d" ans
    0