(ns Atcoder.ABC088-B)
(require '[clojure.string :as str])
(def N (read-string (read-line)))                                         ; N
(def A (map read-string (str/split (read-line) #" ")))      ; A
(def A (sort > A))

(def alice (reduce + (map (fn [x] (nth A x)) (filter even? (range 0 N)))))
(def bob (reduce + (map (fn [x] (nth A x)) (filter odd? (range 0 N)))))

(println (- alice bob))