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 long long maxk = 1000005;
const long long maxai = 10000005;
const long long inf = 0x3f3f3f3f;
long long k;
long long a[maxk];
vector<long long> primes;
long long maxprimes[maxai];
long long cnt[maxai];
void primelist(long long n) {
  primes.clear();
  memset(maxprimes, 0, sizeof(maxprimes));
  for (long long i = 2; i <= n; i++) {
    if (!maxprimes[i]) {
      primes.push_back(i);
      maxprimes[i] = i;
    }
    for (long long j = 0;
         j < primes.size() && primes[j] <= maxprimes[i] && i * primes[j] <= n;
         j++)
      maxprimes[i * primes[j]] = primes[j];
  }
}
int main() {
  primelist(10000000);
  while (scanf("%I64d", &k) == 1) {
    memset(cnt, 0, sizeof(cnt));
    long long Max = 0;
    long long maxval = -inf;
    for (long long i = 1; i <= k; i++) {
      scanf("%I64d", &a[i]);
      cnt[a[i]]++;
      Max += a[i];
      maxval = max(maxval, a[i]);
    }
    for (long long i = maxval; i >= 2; i--) cnt[i] += cnt[i + 1];
    for (long long i = maxval; i >= 2; i--) {
      if (maxprimes[i] != i) cnt[maxprimes[i]] += cnt[i];
      cnt[i / maxprimes[i]] += cnt[i];
    }
    for (long long i = 0; i < primes.size(); i++) cnt[i] = cnt[primes[i]];
    long long L = 1, R = Max;
    while (L < R) {
      long long M = L + (R - L) / 2;
      bool enough = true;
      for (long long i = 0; i < primes.size() && enough; i++) {
        long long tmp = primes[i];
        long long tot = 0;
        while (tmp <= M) {
          tot += M / tmp;
          tmp *= primes[i];
        }
        if (tot < cnt[i]) enough = false;
      }
      if (enough)
        R = M;
      else
        L = M + 1;
    }
    printf("%I64d\n", L);
  }
  return 0;
}