main = do
  n <- getLine
  xs <- map read . words <$> getLine
  putStrLn . show $ solve xs

solve :: [Int] -> Int
solve =  foldl (\(i,r) x) -> (i+1, if i `mod` 2 == 0 then x + r else x - r)) (0,0) (reverse . sort  $ xs)