import Control.Monad
import Data.List
import Data.Ord

main = do
  _ <- getLine
  cs <- sortOn Down . map read . words <$> getLine :: IO [Int]
  let (as, bs) = f cs [] []
  print $ (sum as) - (sum bs)
  
f [] al bo = (al , bo)
f [a] al bo = (al ++ [a], bo)
f (a:b:cs) al bo = f cs (al ++ [a]) (bo ++ [b])
  
  
