#include <bits/stdc++.h>
using namespace std;
int n, a[3001];
int f(int m) {
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    sum += m % a[i];
  }
  return sum;
}
int main() {
  int maxx = -1;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= 30000000; i++) {
    int x;
    if (f(i) >= maxx) {
      maxx = f(i);
      x = i;
    }
  }
  cout << maxx << endl;
}
