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;
int const MAX = 10000001;
vector<int> primes;
void precalc() {
  vector<int> minp(MAX);
  minp[1] = 1;
  for (int k = 2; k * k < MAX; ++k)
    if (!minp[k]) {
      for (int i = k * k; i < MAX; i += k)
        if (!minp[i] || k < minp[i]) {
          minp[i] = k;
        }
    }
  for (int k = 2; k < MAX; ++k)
    if (!minp[k]) {
      primes.push_back(k);
    }
}
void init() {
  vector<bool> is_prime(MAX, true);
  for (int i = 2; i < MAX; ++i)
    if (is_prime[i]) {
      primes.push_back(i);
      for (int j = i + i; j < MAX; j += i) is_prime[j] = false;
    }
}
vector<long long> get(long long n) {
  vector<long long> ans(primes.size(), 0);
  for (int i = 0; i < primes.size(); ++i) {
    long long cur = primes[i];
    while (cur <= n) {
      ans[i] += n / cur;
      cur *= primes[i];
    }
  }
  return ans;
}
bool comp(vector<long long> const& a, vector<long long> const& b) {
  for (int i = 0; i < a.size(); ++i)
    if (a[i] > b[i]) return false;
  return true;
}
vector<int> mask(MAX + 1, 0);
int main() {
  ios_base::sync_with_stdio(false);
  precalc();
  int n = 1000000;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int tmp = 0;
    cin >> tmp;
    ++mask[tmp];
  }
  for (int i = MAX; i > 0; --i) {
    mask[i - 1] += mask[i];
  }
  vector<long long> bad(primes.size(), 0);
  for (int i = 0; i < primes.size(); ++i) {
    long long cur = primes[i];
    while (cur < MAX) {
      long long tmp = cur;
      while (tmp < MAX) {
        bad[i] += mask[tmp];
        tmp += cur;
      }
      cur *= primes[i];
    }
  }
  long long l = 1;
  long long r = 1000000000000000006;
  while (l < r) {
    long long med = l + (r - l) / 2LL;
    vector<long long> t = get(med);
    if (comp(bad, t))
      r = med;
    else
      l = med + 1;
  }
  cout << r << endl;
  return 0;
}