#include <bits/stdc++.h>
using namespace std;
signed main() {
  int a, b[10000], c = 0;
  pair<int, int> p;
  p.first = 0, p.second = 0;
  cin >> a;
  for (int i = 0; i < a; i++) cin >> b[i];
  for (int i = 1; i < 200000; i++) {
    c = 0;
    for (int j = 0; j < a; j++) {
      c += i % b[j];
    }
    if (p.first < c) p.first = c, p.second = i;
  }
  cout << p.second << "\n";
}
