#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  vector<int> a(N, 0);
  for (int i = 0; i < (N); ++i) cin >> a.at(i);
  int max = *max_element(a.begin(), a.end());
  vector<int> f(max, 0);
  for (int m = 0; m < (max); ++m) {
    for (int j = 0; j < (N); ++j) f.at(m) += m % a.at(j);
  }
  cout << *max_element(f.begin(), f.end()) << endl;
}
