import Data.List ( sortBy )
import qualified Data.ByteString.Char8 as C
import Data.Maybe ( fromJust )

readInts :: IO [Int]
readInts = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main :: IO ()
main = do
  _  <- getLine
  as <- readInts 
  print . point . alisAndBob' . sort' $ as

sort' 
  :: Ord a => [a] -> [a]
sort' = sortBy (flip compare)

point
  :: ([Int],[Int]) -> Int
point (as,bs) = sum as - sum bs

alisAndBob'
  :: Ord a => [a] -> ([a],[a])
alisAndBob' ns = (alice, bob)
  where
    helper f = map snd . filter f
    ns' = zip (cycle [True, False]) ns
    alice = helper fst         ns'
    bob   = helper (not . fst) ns'