import Data.List

main = do
    getLine
    ls <- tuplify . sort . map read . words <$> getLine
    print . sum $ zipWith min (map fst ls) (map snd ls)

tuplify [] = []
tuplify (x:y:xs) = (x,y):tuplify xs
