#include <bits/stdc++.h>
using namespace std;
int N;
long a[100000];
void solve() {
  long ans = -1;
  long x;
  for (long i = 1; i < 1000000; i++) {
    x = 0;
    for (int j = 0; j < N; j++) {
      x += i % a[j];
    }
    ans = max(x, ans);
  }
  cout << ans << endl;
  return;
}
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  solve();
  return 0;
}
