#include <bits/stdc++.h>
using namespace std;
const int MAX = 11000111;
int n, a[1000111], sieve[MAX];
long long need[MAX];
int primes[MAX], nPrime;
void init() {
  for (int i = (2), _b = (4000); i <= _b; i++)
    if (!sieve[i]) {
      for (int j = i * i; j < MAX; j += i) sieve[j] = i;
    }
  nPrime = 0;
  for (int i = (2), _b = (MAX - 1); i <= _b; i++)
    if (!sieve[i]) primes[++nPrime] = i;
}
long long get(int p, long long n) {
  if (n < p) return 0;
  return n / p + get(p, n / p);
}
bool check(long long x) {
  for (int i = (1), _b = (nPrime); i <= _b; i++)
    if (get(primes[i], x) < need[primes[i]]) return false;
  return true;
}
int has[MAX];
int main() {
  init();
  while (scanf("%d", &n) == 1) {
    memset(has, 0, sizeof has);
    for (int i = (1), _b = (n); i <= _b; i++) {
      scanf("%d", &a[i]);
      has[a[i]] += 1;
    }
    for (int i = (MAX - 2), _b = (1); i >= _b; i--) has[i] += has[i + 1];
    memset(need, 0, sizeof need);
    int ln = *max_element(a + 1, a + n + 1);
    for (int i = (2), _b = (ln); i <= _b; i++) {
      int u = i;
      while (u > 1) {
        int p = sieve[u] ? sieve[u] : u;
        while (u % p == 0) {
          u /= p;
          need[p] += has[i];
        }
      }
    }
    long long l = 1, r = 1e14, res = r;
    while (l <= r) {
      long long mid = (l + r) >> 1LL;
      if (check(mid)) {
        res = mid;
        r = mid - 1;
      } else
        l = mid + 1;
    }
    cout << res << endl;
  }
  return 0;
}
