#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T read(T &x) {
  x = 0;
  int f = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    f |= (ch == '-'), ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + ch - '0', ch = getchar();
  }
  return x = f ? -x : x;
}
long long vec_pass(long long n, vector<long long> v) {
  long long val = 0;
  for (auto i = v.begin(); i != v.end(); i++) {
    val += (n % (*i));
  }
  return val;
}
int main(void) {
  int n;
  read(n);
  long long highest_value = 0;
  vector<long long> v;
  for (int i = 0; i < n; i++) {
    long long num;
    read(num);
    v.emplace_back(num);
  }
  for (long long i = 1; i <= 100000; i++) {
    long long val = vec_pass(i, v);
    if (val > highest_value) highest_value = val;
  }
  cout << highest_value << "\n";
  return 0;
}
