import Data.List

func' :: (Int,Int,Int) -> Int -> (Int,Int,Int)
func' (a,b,i) n =
  if even i
  then (a+n, b, i+1)
  else (a, b+n, i+1)

func :: [Int] -> (Int, Int, Int)
func = foldl' func' (0,0,0)

main = do
  _ <- getLine
  line <- getLine
  let
    dat' = map read $ words line :: [Int]
    dat = sortBy (\x y -> y `compare` x) dat'
    (a,b,_) = func dat
    ans = a - b
  putStrLn $ show ans
