import qualified Data.List as DL

solve [] a b _ = a-b
solve (e:es) a b True = solve es (a+e) b False
solve (e:es) a b False = solve es a (b+e) True


main = do
  n <- readLn :: IO Int
  as <- map read . words <$> getLine
  let bs = DL.sort as
    in putStrLn $ show $ solve bs 0 0 True
