#include <iostream>
using namespace std;
int main()
{
int n;
int a[1050] = {};
cin >> n;
int maxa = -99999999;
for (int i = 1; i <= n; i++)
{
cin >> a[i];
if (a[i] > maxa)
maxa = a[i];
}
int sum = 0;
for (int i = 1; i <= n; i++)
{
if (maxa == a[i])
continue;
sum += a[i];
}
cout << sum;
return 0;
}