import Data.List
main = do
  n <- readLn :: IO Int
  xs <- reverse . sort . map read . words <$> getLine
  let alice = sum $ map fst $ filter (\(_,i) -> even i) $ zip xs [0..]
  let bob = sum $ map fst $ filter (\(_,i) -> odd i) $ zip xs [0..]
  print $ alice  - bob