import Data.List
import Data.Ord

main :: IO ()
main = do
    getLine
    a_list <- map read . words <$> getLine :: IO [Int]
    print . sum . zipWith (*) (cycle [1,-1]) . sortBy (comparing Down) $ a_list
