import Data.List

main = do
    _ <- getLine
    str <- getLine
    print $ solve $ parse str

parse :: String -> [Int]
parse = map read . words

solve :: [Int] -> Int
solve list = go $ sort list
    where go [] = 0
          go (a:_:c) = a + go c