let n = Scanf.scanf " %d" (+) 0
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let ss = Array.make 2 0
let _ = Array.sort (fun x y -> y - x) a_s;
  Array.iteri (fun i a -> ss.(i mod 2) <- ss.(i mod 2) + a) a_s;
  Printf.printf "%d\n" @@ ss.(0) - ss.(1)