{-# OPTIONS_GHC -O2 #-}

import qualified Data.ByteString.Char8 as C
import Data.List
import qualified Data.Vector.Unboxed as U

r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

main = do
    n <- readLn :: IO Int
    as <- (sortBy (flip compare)) <$> r'
    print $ sum (take (div (n-1) 2 + 1) (map (*2) as))
        - head as
        - (if odd n then as!!(div (n-1) 2) else 0)
