#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long s = 0;
  for (long long i = 0; i < 100100; i++) {
    long long f = 0;
    long long x = i;
    for (long long j = 0; j < n; j++) f += x % a[j];
    s = max(s, f);
  }
  cout << s << endl;
}
