#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int l;
  vector<int> a;
  int num;
  int c;
  int ans = 0;
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &l);
    a.push_back(l);
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  num = a[0] * 2 - 1;
  for (int i = 0; i < num; i++) {
    c = 0;
    for (int j = 0; j < a.size(); j++) {
      c += (num - i) % a[j];
    }
    if (c > ans) ans = c;
  }
  printf("%d\n", ans);
  return 0;
}
