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;
template <typename S, typename T>
ostream& operator<<(ostream& out, pair<S, T> const& p) {
  out << '(' << p.first << ", " << p.second << ')';
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& v) {
  int l = v.size();
  for (int i = 0; i < l - 1; i++) out << v[i] << ' ';
  if (l > 0) out << v[l - 1];
  return out;
}
const int N = 10000001;
int lp[N], primes[N], pcnt;
void getSieve() {
  for (int i = 2; i <= N; i++) {
    if (lp[i] == 0) {
      lp[i] = i;
      primes[pcnt++] = i;
    }
    for (int j = 0; j < pcnt and primes[j] <= lp[i] and i * primes[j] <= N; j++)
      lp[i * primes[j]] = primes[j];
  }
  return;
}
const int M = 1000100;
int k, a, cnt[N], mx;
long long cp[N];
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 < cp[p]) {
      tot += val / d;
      d *= p;
    }
    if (tot < cp[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 = lp[num];
      while (lp[num] == p) {
        cp[p] += cnt[i];
        num /= p;
      }
    }
  }
  long long lo = mx, hi = (1LL << 45), mid;
  while (lo < hi) {
    mid = (lo / 2) + (hi / 2);
    if (f(mid))
      hi = mid;
    else
      lo = mid + 1;
  }
  cout << hi << endl;
  return 0;
}