open Batteries

let read_two () = Scanf.sscanf (read_line ()) "%d %d" (fun a b -> (a, b))

let read_three () =
  Scanf.sscanf (read_line ()) "%d %d %d" (fun a b c -> (a, b, c))

let read_four () =
  Scanf.sscanf (read_line ()) "%d %d %d" (fun a b c d -> (a, b, c, d))

let read_list () =
  read_line () |> String.split_on_char ' '
  |> List.map (fun s -> int_of_string s)

(* a**x *)
let pow a x =
  let rec aux acc = function 0 -> acc | n -> aux (acc * a) (n - 1) in
  aux 1 x

let _ = read_line ()

let rec f (a, b) at = function
  | [] -> (a, b)
  | n :: rest ->
      if at then f (n + a, b) (not at) rest else f (a, n + b) (not at) rest

let () =
  let ls = read_list () |> List.fast_sort (fun x y -> -compare x y) in
  let a, b = f (0, 0) true ls in
  print_int (a - b);
  print_newline ()
