#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < (int)(n); i++) cin >> v.at(i);
  int ans = 0;
  for (int i = 1; i < 100100; i++) {
    int now = 0;
    for (int j = 0; j < (int)(n); j++) {
      now += i % v.at(j);
    }
    ans = max(ans, now);
  }
  cout << ans;
}
