import Data.List

main = do
  n <- readLn :: IO Int
  as <- getLine >>= return . reverse . sort . map read . words :: IO [Int]

  let
    alice = sum [as !! i | i <- [0..n-1], even i]
    bob = sum [as !! i | i <- [0..n-1], odd i]
    
  print $ alice - bob
