#include <bits/stdc++.h>
const double eps = 1e-9;
const long double pi = acos(-1.0);
using namespace std;
const int N = 1e7 + 1;
int n, mx;
long long a[N], del[N];
bool p[N];
vector<int> pr;
bool check(long long x) {
  for (int i = 0; i < pr.size(); i++) {
    long long step = pr[i];
    long long y = pr[i];
    long long cnt = 0;
    while (x / step > 0) {
      cnt += x / step;
      step *= y;
    }
    if (a[pr[i]] > cnt) return false;
  }
  return true;
}
void solve() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    mx = max(mx, x);
    a[x]++;
  }
  for (int i = mx - 1; i >= 2; i--) a[i] += a[i + 1];
  for (int i = 0; i < N; i++) p[i] = true;
  p[0] = p[1] = false;
  for (int i = 2; i < N; i++) {
    if (p[i]) {
      del[i] = i;
      if (i * 1ll * i < N) {
        for (int j = i * i; j < N; j += i) {
          p[j] = false;
          del[j] = i;
        }
      }
    }
  }
  for (int i = mx; i >= 2; i--) {
    if (del[i] != i) {
      a[del[i]] += a[i];
      a[i / del[i]] += a[i];
      a[i] = 0;
    } else {
      pr.push_back(i);
    }
  }
  long long l = 0;
  long long r = 1e13;
  while (r - l > 1) {
    long long m = (l + r) >> 1;
    if (check(m))
      r = m;
    else
      l = m;
  }
  cout << l + 1 << endl;
}
int main() {
  ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
  cout.setf(ios::fixed), cout.precision(10);
  int step;
  step = 1;
  for (int i = 1; i <= step; i++) {
    solve();
  }
}
