function main(input) {
  const n = parseInt(input[0]);
  const a = sortU(input[1].trim().split(" ").map(i => parseInt(i)));

  if(a.length===2){
    console.log(a[0]+a[1]);
  }else{
    let sum = 0;
    for(let i=1;i<(a.length);i++){
      sum+=a[i];
    }
    console.log(sum);
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));

function sortU(arr){return arr.sort(function(a, b) {return a - b;})}