#include <bits/stdc++.h>
using namespace std;
template <typename S, typename T>
ostream& operator<<(ostream& out, pair<S, T> const& p) {
  out << '(' << p.first << ", " << p.second << ')';
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& v) {
  int l = v.size();
  for (int i = 0; i < l - 1; i++) out << v[i] << ' ';
  if (l > 0) out << v[l - 1];
  return out;
}
const int N = 10000001;
int lp[N], primes[N], pcnt;
void getSieve() {
  for (int i = 2; i <= N; i++) {
    if (lp[i] == 0) {
      lp[i] = i;
      primes[pcnt++] = i;
    }
    for (int j = 0; j < pcnt and primes[j] <= lp[i] and i * primes[j] <= N; j++)
      lp[i * primes[j]] = primes[j];
  }
  return;
}
const int M = 1000100;
int k, a, cnt[N], mx;
long long cp[N];
int f(long long val) {
  long long p, d, tot;
  for (int i = 0; i < pcnt and primes[i] <= val; i++) {
    d = p = primes[i], tot = 0;
    while (d <= val and tot < cp[p]) {
      tot += val / d;
      d *= p;
    }
    if (tot < cp[p]) return 0;
  }
  return 1;
}
int main() {
  getSieve();
  scanf("%d", &k);
  for (int i = 1; i <= k; i++) {
    scanf("%d", &a);
    mx = max(mx, a);
    cnt[1]++;
    cnt[a + 1]--;
  }
  int p, num;
  for (int i = 1; i <= mx; i++) {
    cnt[i] += cnt[i - 1];
    num = i;
    while (num > 1) {
      p = lp[num];
      while (lp[num] == p) {
        cp[p] += cnt[i];
        num /= p;
      }
    }
  }
  long long lo = mx, hi = (1LL << 45), mid;
  while (lo < hi) {
    mid = (lo / 2) + (hi / 2);
    if (f(mid))
      hi = mid;
    else
      lo = mid + 1;
  }
  cout << hi << endl;
  return 0;
}
