#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    int *a = new int[n];
    vector<long> b;
    int i;
    for (i = 0; i < n; i++) cin >> a[i];
    long sum = 0;
    for (int j = 0; j < 10000; j++) {
      for (i = 0; i < n; i++) sum += j % a[i];
      b.push_back(sum);
    }
    double max = b[0];
    for (i = 0; i < b.size(); i++)
      if (b[i] >= max) max = b[i];
    cout << max << endl;
    delete[] a;
  }
}
