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 N = 11111111;
const int M = 11111111;
long long lala2[N];
int lala[N], primes[N], pcnt;
int k;
int cnt[N];
int mx;
int a;
void getSieve() {
  for (int i = 2; i <= N; i++) {
    if (lala[i] == 0) {
      lala[i] = i;
      primes[pcnt++] = i;
    }
    for (int j = 0; j < pcnt and primes[j] <= lala[i] and i * primes[j] <= N;
         j++)
      lala[i * primes[j]] = primes[j];
  }
  return;
}
int f(long long val) {
  long long p, d, tot;
  for (int i = 0; i < pcnt and primes[i] <= val; i++) {
    d = p = primes[i], tot = 0;
    while (d <= val and tot < lala2[p]) {
      tot += val / d;
      d *= p;
    }
    if (tot < lala2[p]) return 0;
  }
  return 1;
}
int main() {
  getSieve();
  scanf("%d", &k);
  for (int i = 1; i <= k; i++) {
    scanf("%d", &a);
    mx = max(mx, a);
    cnt[1]++;
    cnt[a + 1]--;
  }
  int p, num;
  for (int i = 1; i <= mx; i++) {
    cnt[i] += cnt[i - 1];
    num = i;
    while (num > 1) {
      p = lala[num];
      while (lala[num] == p) {
        lala2[p] += cnt[i];
        num /= p;
      }
    }
  }
  long long lo = mx, hi = (1LL << 45), mid;
  while (lo < hi) {
    mid = (lo + hi) >> 1;
    if (f(mid))
      hi = mid;
    else
      lo = mid + 1;
  }
  printf("%lld\n", hi);
  return 0;
}