{-# LANGUAGE TypeApplications #-}

module Main where

import Data.List (sortOn)
import Data.Ord (Down(Down))

main :: IO ()
main = do
  n <- readLn @Int
  as <- map (read @Int) . words <$> getLine
  let comfs@(mx : _) = take n $ replicate 2 =<< (sortOn Down as)
  print $ sum comfs - mx
