#include<bits/stdc++.h> using namespace std; int x[100010]; int main() { int n , s = 0, max = -2e9; cin >> n; for (int i = 1; i <= n; i++) { cin >> x[i]; s = s + x[i]; if(x[i] > max) { max = x[i]; } } cout << s - max; return 0; }