#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long ara[n + 5];
  for (int i = 0; i < n; i++) cin >> ara[i];
  long long ans = 0, now = 0;
  for (int i = 1; i <= 100000; i++) {
    now = 0;
    for (int j = 0; j < n; j++) now += i % ara[j];
    ans = max(ans, now);
  }
  cout << ans << endl;
  return 0;
}
