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;
long long GetP(long long x, long long p) {
  long long res = 0;
  while (x) {
    res = res + x / p;
    x = x / p;
  }
  return res;
}
const int INF = 1 << 30;
int L, U;
int p[10000007], sz;
bool flag[10000007];
void sieve(int L, int U) {
  int d = U - L + 1;
  for (int i = 0; i < d; ++i) flag[i] = true;
  for (int i = (L % 2 != 0); i < d; i += 2) flag[i] = false;
  for (int i = 3; i <= sqrt(U); i += 2) {
    if (i > L && flag[i - L] == false) continue;
    int j = L / i * i;
    if (j < L) j += i;
    if (j == i) j += i;
    j = j - L;
    for (; j < d; j += i) flag[j] = false;
  }
  if (L <= 1) flag[1 - L] = false;
  if (L <= 2) flag[2 - L] = true;
  sz = 0;
  for (int i = 0; i < d; ++i)
    if (flag[i] == true) p[sz++] = i + L;
}
int vis[10000007], k;
int main() {
  sieve(1, 10000000);
  scanf("%d", &k);
  for (int i = 1; i <= k; i++) {
    int v;
    scanf("%d", &v);
    vis[v]++;
  }
  for (int i = 10000003; i >= 0; i--) vis[i] += vis[i + 1];
  long long res = 1;
  for (int i = 0; i < sz; i++) {
    long long tot = 0;
    for (long long j = p[i]; j <= 10000003; j *= (long long)p[i])
      for (long long k = j; k <= 10000003; k += j) tot += vis[k];
    long long l = res, r = 1LL << 61;
    while (l < r) {
      long long m = (l + r) >> 1;
      if (GetP(m, p[i]) >= tot) {
        r = m;
      } else
        l = m + 1;
    }
    res = l;
  }
  cout << res << endl;
  return 0;
}