'use strict';

function Main(input) {
    let [N, A] = input.trim().split('\n');
    N = Number(N);
    A = A.split(' ')
        .map((v) => Number(v))
        .sort((a, b) => b - a);

    A.pop();
    const answer = A.reduce((sum, cur) => (sum += cur));

    console.log(String(answer));
    return;
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));