import Data.List
main = do
  n <- getLine
  xs <- map read . words <$> getLine
  putStrLn . show $ solve xs
 
solve :: [Int] -> Int
solve xs =  snd $ foldl calc (0,0) (reverse . sort  $ xs)

calc (i,r) x
 | i `mod` 2 == 0 = (i+1, r+x)
 | otherwise      = (i+1, r-x)