#include <bits/stdc++.h>
using namespace std;
int Get() {
  char c;
  while (c = getchar(), c < '0' || c > '9')
    ;
  int X = 0;
  while (c >= '0' && c <= '9') {
    X = X * 10 + c - 48;
    c = getchar();
  }
  return X;
}
int Total;
int Prime[10000000];
long long Count[10000000];
long long Check(long long X) {
  for (int i = 0; i < Total; i++) {
    long long Sum = 0, T = X;
    while (T) {
      Sum += T / Prime[i];
      T /= Prime[i];
    }
    if (Sum < Count[i]) return false;
  }
  return true;
}
int main() {
  int N = Get();
  static int A[1000000];
  for (int i = 0; i < N; i++) A[i] = Get();
  sort(A, A + N);
  static bool Flag[10000001];
  static int Min[10000001];
  memset(Flag, 0, sizeof(Flag));
  Total = 0;
  for (int i = 2; i <= 10000000; i++) {
    if (!Flag[i]) {
      Min[i] = Total;
      Prime[Total++] = i;
    }
    for (int j = 0; j < Total && i * Prime[j] <= 10000000; j++) {
      Flag[i * Prime[j]] = true;
      Min[i * Prime[j]] = j;
      if (!(i % Prime[j])) break;
    }
  }
  static long long Delta[10000001];
  for (int i = 10000000, j = N; i >= 2; i--) {
    while (j && A[j - 1] >= i) j--;
    Delta[i] = N - j;
  }
  memset(Count, 0, sizeof(Count));
  for (int i = 10000000; i >= 2; i--) {
    Count[Min[i]] += Delta[i];
    Delta[i / Prime[Min[i]]] += Delta[i];
  }
  long long Left = 1, Right = 0;
  for (int i = 0; i < N; i++) Right += A[i];
  while (Left < Right) {
    long long Mid = (Left + Right) / 2;
    if (Check(Mid))
      Right = Mid;
    else
      Left = Mid + 1;
  }
  cout << Left << endl;
  return 0;
}
