#include <bits/stdc++.h>
using namespace std;
template <class T, class T2>
inline bool chkmax(T &x, const T2 &y) {
  return x < y ? x = y, 1 : 0;
}
template <class T, class T2>
inline bool chkmin(T &x, const T2 &y) {
  return x > y ? x = y, 1 : 0;
}
const long long mod = 1e9 + 7;
template <class T>
inline void fix(T &x) {
  if (x >= mod | x <= -mod) {
    x %= mod;
  }
  if (x < 0) {
    x += mod;
  }
}
const long long MAX_N = 1e7 + 10;
vector<long long> primes;
long long cnt[MAX_N], lp[MAX_N];
void sieve() {
  lp[0] = lp[1] = 1;
  for (long long i = 2; i < MAX_N; i++) {
    if (lp[i] == 0) {
      lp[i] = i;
      primes.push_back(i);
    }
    for (auto it : primes) {
      if (it > lp[i] || it * i >= MAX_N) {
        break;
      }
      lp[it * i] = it;
    }
  }
  for (long long i = MAX_N - 1; i > 1; i--) {
    cnt[lp[i]] += (long long)(lp[i] != i) * cnt[i];
    cnt[i / lp[i]] += cnt[i];
  }
}
long long n, arr[MAX_N];
bool eval(long long x) {
  for (auto it : primes) {
    long long cpy = x;
    long long ans = 0;
    while (cpy > 0) {
      cpy /= it;
      ans += cpy;
    }
    if (ans < cnt[it]) {
      return false;
    }
  }
  return true;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  long long l = 0, r;
  for (long long i = 1; i <= MAX_N; i++) {
    while (l < n && arr[l] < i) {
      l++;
    }
    cnt[i] += n - l;
  }
  sieve();
  l = 0, r = MAX_N * MAX_N;
  while (l < r - 1) {
    long long m = (l + r) / 2ll;
    if (eval(m)) {
      r = m;
    } else {
      l = m;
    }
  }
  cout << r << "\n";
  return 0;
}
