let () =
  Scanf.scanf "%d\n" @@ fun n ->
  let arr = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun d -> d in
  let _ = Array.fast_sort (fun x y -> y-x) arr in
  let ((alice,bob),_) = Array.fold_left 
                     (fun ((a,b),i) x -> 
          if i mod 2 = 1 then ((a+x,b),i+1) else ((a,b+x),i+1)) ((0,0),1) arr in
  Printf.printf "%d\n" (alice-bob)