import qualified Data.ByteString.Char8 as B
import           Data.Char
import           Data.List

main :: IO ()
main = do
    n <- readLn
    as <- sortBy (flip compare) <$> readInts
    print $ solve n as

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

solve :: Int -> [Int] -> Int
solve 0 _        = 0
solve n (a:b:as) = b + solve (n - 1) as