Problem: In a far away galaxy there is war again. The treacherous Republic made k precision strikes of power ai on the Empire possessions. To cope with the republican threat, the Supreme Council decided to deal a decisive blow to the enemy forces. 

To successfully complete the conflict, the confrontation balance after the blow should be a positive integer. The balance of confrontation is a number that looks like <image>, where p = n! (n is the power of the Imperial strike), <image>. After many years of war the Empire's resources are low. So to reduce the costs, n should be a minimum positive integer that is approved by the commanders.

Help the Empire, find the minimum positive integer n, where the described fraction is a positive integer.

Input

The first line contains integer k (1 ≤ k ≤ 106). The second line contains k integers a1, a2, ..., ak (1 ≤ ai ≤ 107).

Output

Print the minimum positive integer n, needed for the Empire to win.

Please, do not use the %lld to read or write 64-but integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator.

Examples

Input

2
1000 1000


Output

2000

Input

1
2


Output

2

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int MaxK = 1000000;
const int MaxNum = 10000001;
const long long MAX = 10000000000001;
long long a[MaxK];
int lp[MaxNum];
vector<int> pr;
long long hMany[MaxNum];
long long q[10000];
int sz = 0;
bool ok(long long n, long long sum) {
  long long S = 0;
  for (int i = 1; i <= sz; i++) S += n / q[i];
  if (S >= sum)
    return true;
  else
    return false;
}
long long get(long long n, long long sum) {
  sz = 0;
  q[++sz] = n;
  long long t = n;
  while (t <= MAX / n) {
    q[++sz] = t * n;
    t *= n;
  }
  long long l = 1, r = sum * n;
  if (n == 2) {
  }
  while (l < r - 1) {
    long long mid = (l + r) / 2;
    if (ok(mid, sum))
      r = mid;
    else
      l = mid;
  }
  if (ok(l, sum))
    return l;
  else
    return r;
}
int main() {
  int k;
  scanf("%d", &k);
  for (int i = 0; i < k; i++) scanf("%lld", &a[i]);
  for (int i = 2; i < MaxNum; i++) {
    if (lp[i] == 0) {
      lp[i] = i;
      pr.push_back(i);
    }
    for (int j = 0; j < (int)pr.size() && pr[j] <= lp[i] && i * pr[j] < MaxNum;
         j++)
      lp[i * pr[j]] = pr[j];
  }
  sort(a, a + k);
  int pos = 0;
  for (long long i = 1; i <= a[k - 1]; i++) {
    int x = i;
    while (x != 1) {
      hMany[lp[x]] += (long long)(k - pos);
      x /= lp[x];
    }
    while (pos != k && i >= a[pos]) pos++;
  }
  long long res = 0;
  if (a[k - 1] == 1) {
    cout << "1";
    return 0;
  }
  for (long long i = 2; i <= a[k - 1]; i++) {
    res = (((res) > (get(i, hMany[i]))) ? (res) : (get(i, hMany[i])));
  }
  cout << res;
}