import Data.List
 
main :: IO ()
main = do
  getLine
  l <- sort <$> map read . words <$> getLine :: IO [Int]
  let
    solve []  = []
    solve (x:y:xs) = (min x y) : solve xs
  print $ sum $ solve l