let input_int_array n =
  Array.init n (fun _ -> Scanf.scanf "%d " (fun v -> v))

let () =
  let n = read_int ()
  in let cards = input_int_array n
  in Array.sort Pervasives.compare cards;
  Array.fold_left (fun (v,i) c ->
    (if i mod 2 = 0 then v+c else v-c), i+1
  ) (0,0) cards
  |> (fun (u,_) -> abs u)
  |> Printf.printf "%d\n"