import Control.Applicative
import Data.List

solve :: [Int] -> Int
solve [] = 0
solve [x] = 0
solve (x:y:xs) = y + solve xs

main :: IO ()
main = do
        getLine
        arr <- map read . words <$> getLine
        let sorted = reverse . sort $ arr
        putStrLn . show . solve $ sorted
