import Data.List

solve :: Int -> (Int, Int) -> [Int] -> Int
solve _	(a, b) [] = abs	$ a - b
solve n	(a, b) (x:xs)
  | even n = solve (n+1) (a+x, b) xs
  | otherwise = solve (n+1) (a, b+x) xs

main = getLine >> getContents >>= print . solve 1 (0,0) . reverse . sort . map read . words