import Control.Monad
import Data.List

main = do
  n <- readLn
  ans <- sum . map snd . filter fst . zip (cycle [False, True]) . take (2*n) . sortBy (flip compare) . map read . words <$> getLine
  print ans