#include <bits/stdc++.h>
using namespace std;
long long fact_pow(long long n, long long k) {
  long long res = 0;
  while (n) {
    n /= k;
    res += n;
  }
  return res;
}
int main() {
  long long n, i, j, a, b, sum;
  sum = 0;
  static vector<long long> ig(10000002, 0);
  static vector<long long> prs(10000002, 0);
  cin >> n;
  for (i = 0; i < n; ++i) {
    scanf("%I64d", &a);
    ig[0]++;
    ig[a + 1]--;
  }
  a = 0;
  for (i = 0; i < prs.size(); ++i) {
    a += ig[i];
    prs[i] = a;
  }
  vector<int> temp;
  vector<int> q(10000002, 1);
  for (i = 2; i < q.size(); ++i) {
    if (q[i]) {
      a = i;
      for (j = a + a; j < q.size(); j += a) {
        q[j] = 0;
        if (prs[j] > 0) {
          b = j;
          long long k;
          k = 0;
          while (b && b % a == 0) {
            k++;
            b = b / a;
          }
          prs[a] += prs[j] * k;
          prs[b] += prs[j];
          prs[j] = 0;
        }
      }
      if (prs[i] > 0) {
        temp.push_back(i);
        sum = i;
      }
    }
  }
  long long ans;
  if (sum != 0) {
    sum--;
  }
  a = sum;
  b = 10000000000000000;
  if (temp.size() == 0)
    cout << 1;
  else {
    while (a + 2 <= b) {
      int ok = 1;
      ans = (a + b) / 2;
      for (i = temp.size() - 1; i >= 0; --i) {
        if (fact_pow(ans, temp[i]) < prs[temp[i]]) {
          ok = 0;
          break;
        }
      }
      if (ok) {
        b = ans;
      } else {
        a = ans;
      }
    }
    cout << b;
  }
  return 0;
}
