#include <bits/stdc++.h>
using namespace std;
long long func(long long m, vector<long long> A) {
  long long ans = 0;
  for (auto i : A) ans = ans + m % i;
  return ans;
}
void solve(long long N, std::vector<long long> A) {
  long long ans = 0;
  for (int i = 2; i < 10000000; ++i) {
    ans = max(ans, func(i, A));
  }
  cout << ans << endl;
}
int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, std::move(A));
  return 0;
}
