#include <bits/stdc++.h>
using namespace std;
long long GetP(long long x, long long p) {
  long long res = 0;
  while (x) {
    res = res + x / p;
    x = x / p;
  }
  return res;
}
const int INF = 1 << 30;
int L, U;
int p[10000007], sz;
bool flag[10000007];
void sieve(int L, int U) {
  int d = U - L + 1;
  for (int i = 0; i < d; ++i) flag[i] = true;
  for (int i = (L % 2 != 0); i < d; i += 2) flag[i] = false;
  for (int i = 3; i <= sqrt(U); i += 2) {
    if (i > L && flag[i - L] == false) continue;
    int j = L / i * i;
    if (j < L) j += i;
    if (j == i) j += i;
    j = j - L;
    for (; j < d; j += i) flag[j] = false;
  }
  if (L <= 1) flag[1 - L] = false;
  if (L <= 2) flag[2 - L] = true;
  sz = 0;
  for (int i = 0; i < d; ++i)
    if (flag[i] == true) p[sz++] = i + L;
}
int vis[10000007], k;
int main() {
  sieve(1, 10000000);
  scanf("%d", &k);
  for (int i = 1; i <= k; i++) {
    int v;
    scanf("%d", &v);
    vis[v]++;
  }
  for (int i = 10000003; i >= 0; i--) vis[i] += vis[i + 1];
  long long res = 1;
  for (int i = 0; i < sz; i++) {
    long long tot = 0;
    for (long long j = p[i]; j <= 10000003; j *= (long long)p[i])
      for (long long k = j; k <= 10000003; k += j) tot += vis[k];
    long long l = res, r = 1LL << 61;
    while (l < r) {
      long long m = (l + r) >> 1;
      if (GetP(m, p[i]) >= tot) {
        r = m;
      } else
        l = m + 1;
    }
    res = l;
  }
  cout << res << endl;
  return 0;
}
