#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int a[N];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  long long ans2 = 0;
  for (int m = 0; m < 1100000; m++) {
    for (int i = 0; i < N; i++) {
      ans2 += m % a[i];
    }
    if (ans2 >= ans) {
      ans = ans2;
    }
    ans2 = 0;
  }
  cout << ans << endl;
}
