#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e6;
const int MAX_A = 1e7 + 5;
long long P[MAX_A];
int A[MAX_N], n;
int ok[MAX_A];
int prime[700000], num = 0;
void prime_init() {
  num = 0;
  for (int i = 2; i <= 1e7; i++)
    if (ok[i] == 0) {
      prime[num++] = i;
      int j = i;
      while (j <= 1e7) {
        if (ok[j] == 0) ok[j] = i;
        j += i;
      }
    }
}
void input() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &A[i]);
}
void init() {
  for (int i = 0; i < n; i++) P[A[i]]++;
  for (int i = 1e7; i > 1; i--) P[i] += P[i + 1];
  P[1] = 0;
  for (int i = 1e7; i > 1; i--)
    if (P[i]) {
      int tmp = ok[i];
      if (tmp == i) continue;
      P[i / tmp] += P[i];
      P[tmp] += P[i];
    }
}
bool meet(long long k) {
  for (int i = 0; i < num; i++) {
    long long tmp = k;
    long long c = 0;
    while (tmp /= prime[i]) c += tmp;
    if (c < P[prime[i]]) return 0;
  }
  return 1;
}
void solve() {
  long long r = 0, l = 0;
  for (int i = 0; i < n; i++) r += 1ll * A[i];
  while (l + 1 < r) {
    long long mid = (l + r) / 2;
    if (meet(mid))
      r = mid;
    else
      l = mid;
  }
  cout << r;
}
int main() {
  prime_init();
  input();
  init();
  solve();
  return 0;
}
