"use strict";

function main(arg) {
    const input = arg.split("\n")
    let N = Number(input[0])
    let A = input[1].split(" ").map(Number).sort((a,b)=>b-a)
    //console.log(A)
    
    let dp=[]// i人目入った時の心地よさ合計最大値
    for(let i=0; i<N; i++) {
        dp.push(0)
    }
    let min = 0
    for(let i=1; i<N; i++) {
        dp[i]=dp[i-1]+A[(i===1?0:1)]
    }
    console.log(dp[N-1])

}

main(require("fs").readFileSync("/dev/stdin", "utf8"));