module Main where
import Data.Char
import Data.List
int = read :: String -> Int
getWord :: IO String
getWord = do
  c <- getChar
  if isSpace c
  then
    return []
  else do
    ws <- getWord
    return (c:ws)
getInt = fmap int getWord
replace pred a = map (\x -> if pred x then a else x)

main = interact $ printer . solver . parser
parser = tail . map int . words
printer = unlines . (:[]) . show

solver as = alice - bob
  where
    sorted = zip [1..] (reverse $ sort as)
    alice = sum $ map snd $ filter (odd . fst) sorted
    bob = sum $ map snd $ filter (even . fst) sorted