import Control.Monad
import Data.List
main=do
    _<-getLine
    as<-reverse.sort.map read.words<$>getLine::IO[Int]
    print $ liftM2 (-) fst snd $ g (0,0) as

g (a,b) [] = (a,b)
g (a,b) [x] = (a+x,b)
g (a,b) (x:y:ar) = g (a+x,b+y) ar
