#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = (0); i < (n); ++i) cin >> v[i];
  int maxvalue = 0;
  for (int i = (0); i < (1000000); ++i) {
    int tmp = 0;
    for (int k = (0); k < (n); ++k) {
      tmp += i % v[k];
    }
    maxvalue = max(tmp, maxvalue);
  }
  cout << maxvalue << endl;
}
