const input = require("fs").readFileSync("/dev/stdin", "utf8")

;(input => {

    const lines = input.split('\n')
    const N = lines[0] - 0
    const A = lines[1].split(" ").map(Number)

    A.sort((a, b) => b - a)

    let com = 0
    for (let i = 0; i < N - 1; i++) {
        com += A[i]
    }

    console.log(com)

})(input)
