#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, i, sum, M;
  sum = 0;
  M = 0;
  cin >> N;
  int a[N];
  for (i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int j = 0; j < 1000000; j++) {
    for (i = 0; i < N; i++) {
      sum += j % a[i];
    }
    if (sum > M) {
      M = sum;
    }
    sum = 0;
  }
  cout << M << endl;
}
