import Data.List(sort)

main = do
  ns <- fmap (fmap (read :: String -> Int) . words) . lines <$> getContents
  putStrLn $ show $ solve $ concat $ tail ns

solve :: [Int] -> Int
solve ls = calc 0 0 sorted
  where
     e = if mod (length ls) 2 == 0 then ls else 0 : ls
     sorted = reverse $ sort e

calc :: Int -> Int -> [Int] -> Int
calc a b [] = subtract b a
calc a b src = calc (head h + a) (last h + b) (drop 2 src)
  where
    h = take 2 src