module Main where
import Data.List

main :: IO ()
main = do
  n <- readLn :: IO Int
  ls <- getInts 
  print $ solve ls

solve :: [Int] -> Int
solve ls = loop ls' 0
  where
    ls' = sort ls
    loop (l1:l2:ls) acc = loop ls (acc + min l1 l2)
    loop _ acc = acc

getInts :: IO [Int]
getInts = map read . words <$> getLine
