import Control.Applicative 
import Data.List

sum' 0 y = 0
sum' x (y:yy:ys) =sum' (x-1) ys + yy;   

main = do
	n <- fmap(read::String ->Int) . words<$>getLine
	l <- fmap(read::String ->Int) . words<$>getLine
	print  $ sum' (n !! 0) (reverse (sort l))
 
		




