#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int a[3000];
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> a[i];
  int M = 200000;
  int ans = 0;
  int tmp;
  for (int m = 0; m < M; ++m) {
    tmp = 0;
    for (int i = 0; i < N; ++i) {
      tmp += m % a[i];
    }
    ans = max(ans, tmp);
  }
  cout << ans << endl;
}
