#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  priority_queue<int, vector<int>, greater<int> > que;
  for (int i = 0; i < (n); i++) {
    int x;
    cin >> x;
    que.push(x);
    a[i] = x;
  }
  long long sum = 0;
  for (int i = 0; i < (n); i++) {
    sum += a[i];
  }
  sum -= que.top();
  cout << sum << endl;
  return 0;
}
