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;
vector<long long> sieve(long long n) {
  vector<long long> lp(n + 1);
  for (long long i = 0; i <= n; i++) lp[i] = i;
  for (long long i = 2; i * i <= n; i++)
    if (lp[i] == i)
      for (long long j = i * i; j <= n; j += i) lp[j] = i;
  return lp;
}
vector<long long> factoVector(vector<long long> v,
                              const vector<long long>& lp) {
  vector<long long> ans(v.size(), 0);
  for (long long i = v.size() - 1; i >= 2; i--) {
    if (lp[i] != i)
      v[lp[i]] += v[i];
    else
      ans[i] = v[i];
    v[i / lp[i]] += v[i];
  }
  return ans;
}
bool ok(long long n, const vector<long long>& aux, const vector<int>& primes) {
  for (int id = 0; id < primes.size(); id++) {
    int i = primes[id];
    if (aux[i]) {
      long long cnt = 0;
      long long val = n;
      while (val) {
        cnt += (val / i);
        val /= i;
      }
      if (cnt < aux[i]) return 0;
    }
  }
  return 1;
}
int main() {
  vector<int> a;
  vector<long long> v;
  int k, mx = 0;
  scanf("%d", &k);
  a.resize(k);
  for (long long i = 0; i < k; i++) {
    scanf("%d", &a[i]);
    mx = max(mx, a[i]);
  }
  v.resize(mx + 1);
  for (long long i = 0; i < k; i++) v[a[i]]++;
  for (long long i = mx - 1; i >= 0; i--) v[i] += v[i + 1];
  vector<long long> lp = sieve(mx + 1);
  vector<long long> aux = factoVector(v, lp);
  vector<int> primes;
  for (int i = 2; i <= mx; i++)
    if (lp[i] == i) primes.push_back(i);
  long long l = 1, r = 1LL << 60;
  long long res = r;
  while (l <= r) {
    long long md = (l + r) / 2;
    if (ok(md, aux, primes)) {
      r = md - 1;
      res = min(res, md);
    } else {
      l = md + 1;
    }
  }
  cout << res << endl;
}