#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3000;
int main() {
  int n;
  long a[MAXN];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int c = 0;
  int sum = n;
  int ans = n;
  int x = 2;
  while (sum != 0) {
    sum = 0;
    for (int i = 0; i < n; i++) {
      { sum += (x % a[i]); }
    }
    if (ans < sum) ans = sum;
    x++;
  }
  printf("%d\n", ans);
  return 0;
}
