import Control.Monad
import Data.Char
import Data.Function
import Data.List
import qualified Data.ByteString.Char8 as BS

main ::IO()
main = do
  n <- readLn
  nss <- replicateM n getIntList
  let [ns, ms] = transpose $ sortBy (flip compare `on` sum) nss
  print $ solve ns ms
  where
    solve [] [] = 0
    solve (n:ns) (m:ms) = n - solve ms ns

getIntList :: IO [Int]
getIntList = unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine