import Data.List
import qualified Data.ByteString.Char8 as BS
main=do
 n<-readLn;a<-reverse.sort.map (read.BS.unpack).BS.words<$>BS.getLine
 print(f n a)
  where f 0 a = 0
        f n (x:y:a) = y+(f (n-1) a)