(*
ocamlfind ocamlopt -package batteries -linkpkg main.ml -o a.out
*)
open Batteries

let lst =
        Scanf.sscanf (read_line ()) "%d" (
                fun _ -> 
                        Str.split (Str.regexp " ") (read_line ())
                        |> List.map int_of_string
                        |> List.sort (fun a b -> - compare a b)
        )

let rec f lst =
        match lst with
                [] -> 0
                | first :: second :: rest -> 
                        (first - second) + f rest
                | first :: rest -> 
                        first + f rest

let () = 
        abs (f lst)
      |> Printf.printf "%d\n"
