const main = async () => {
  const input = require('fs').readFileSync('/dev/stdin', 'UTF-8').trim()
  const [hString, aStrings] = input.split('\n')
  const h = Number(hString)
  const as = aStrings.split(' ').map(Number)

  as.sort((a, b) => b - a)
  as.pop()
  const comfortableness = as.reduce((a, v) => a + v)
  
  console.log(comfortableness)
}

main()