import Control.Applicative 
import Data.Char
import Debug.Trace
import Data.List

splitInt :: String -> [Integer]
splitInt "" = [] :: [Integer]
splitInt str =
    let charToInt :: Integer -> Char -> Integer
        charToInt d c = d * 10 + (fromIntegral $ digitToInt c) :: Integer
        checkInt :: Integer -> String -> (Integer, String)
        checkInt d "" = (d, "")
        checkInt d (' ':rest) = (d, rest)
        checkInt d (c:rest) = checkInt (charToInt d c)  rest
        (num, rest) = checkInt 0 str
        in num : splitInt rest

separate :: [Integer] -> (Integer, Integer)
separate [] = (0, 0)
separate [x] = (x, 0)
separate (x:y:rest) = 
    let (a, b) = separate rest
        in (a + x, b + y)

minus :: (Integer, Integer) -> Integer
minus (a, b) = a - b
main = do
    getLine
    print =<< minus <$> separate <$> reverse <$> sort <$> splitInt <$> getLine
