import Data.List

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

solve:: [Int]-> Int
solve a = draw 0 0 $ reverse $ sort a

draw:: Int -> Int -> [Int] -> Int
draw c n [] = n
draw 0 n (a:as) = draw 1 (n + a) as
draw 1 n (a:as) = draw 0 (n - a) as
