import Data.List
--condition:decendent order sorted
pt::[Int]->(Int,Int)->(Int,Int)
pt [] (x,y) = (x,y)
pt (i:[]) (x,y) = (x+i,y)
pt (i:j:rest) (x,y) = pt rest (x+i,y+j)

solver::[Int]->Int
solver xs = let dec_std = sortBy (\ x -> \ y -> compare y x ) xs in
            let (a,b) = pt dec_std (0,0) in
            a-b

main::IO()
main=do
  _<-getLine
  dat<-getLine
  let ls = map read (words dat)
  print (solver ls) 