import Data.List( sort)
main = do
    n <- (readLn::IO Int)
    ls <- return . map (read::String->Int) . words =<< getLine
    let sortedls = sort ls
	mins [] = []
	mins (l1:l2:ls) = (min l1 l2):mins ls
    print . sum $ mins sortedls