import qualified Data.List as List
import Data.Ord

main :: IO ()
main = do
  n <- readLn
  xs <- map read . words <$> getLine
  print $ solve n xs

solve :: Int -> [Int] -> Int
solve n xs =
  let
    xs' = List.sortBy (flip compare) xs
    makePair [] = []
    makePair (x:y:ys) = y : makePair ys
  in
    sum . take n $ makePair xs'