#include <bits/stdc++.h>
using namespace std;
const int MaxK = 1000000;
const int MaxNum = 10000001;
const long long MAX = 10000000000001;
long long a[MaxK];
int lp[MaxNum];
vector<int> pr;
long long hMany[MaxNum];
long long q[10000];
int sz = 0;
bool ok(long long n, long long sum) {
  long long S = 0;
  for (int i = 1; i <= sz; i++) S += n / q[i];
  if (S >= sum)
    return true;
  else
    return false;
}
long long get(long long n, long long sum) {
  sz = 0;
  q[++sz] = n;
  long long t = n;
  while (t <= MAX / n) {
    q[++sz] = t * n;
    t *= n;
  }
  long long l = 1, r = sum * n;
  if (n == 2) {
  }
  while (l < r - 1) {
    long long mid = (l + r) / 2;
    if (ok(mid, sum))
      r = mid;
    else
      l = mid;
  }
  if (ok(l, sum))
    return l;
  else
    return r;
}
int main() {
  int k;
  scanf("%d", &k);
  for (int i = 0; i < k; i++) scanf("%lld", &a[i]);
  for (int i = 2; i < MaxNum; i++) {
    if (lp[i] == 0) {
      lp[i] = i;
      pr.push_back(i);
    }
    for (int j = 0; j < (int)pr.size() && pr[j] <= lp[i] && i * pr[j] < MaxNum;
         j++)
      lp[i * pr[j]] = pr[j];
  }
  sort(a, a + k);
  int pos = 0;
  for (long long i = 1; i <= a[k - 1]; i++) {
    int x = i;
    while (x != 1) {
      hMany[lp[x]] += (long long)(k - pos);
      x /= lp[x];
    }
    while (pos != k && i >= a[pos]) pos++;
  }
  long long res = 0;
  if (a[k - 1] == 1) {
    cout << "1";
    return 0;
  }
  for (long long i = 2; i <= a[k - 1]; i++) {
    res = (((res) > (get(i, hMany[i]))) ? (res) : (get(i, hMany[i])));
  }
  cout << res;
}
