#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < N; i++) cin >> A[i];
  int maxV = 0;
  for (int i = 1; i <= 1000000; i += 2) {
    int ans = 0;
    for (int j = 0; j < N; j++) {
      ans += i % A[j];
    }
    maxV = max(ans, maxV);
  }
  cout << maxV << endl;
  return 0;
}
