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 inf = 1e13 + 5;
const int MAXN = 1e6 + 5, MAXA = 1e7 + 5;
mt19937 rnd(69420);
int n;
int a[MAXN];
vector<int> primes1, primes2;
vector<long long> primes1Demand, primes2Demand;
int bigger[MAXA];
bool prime[MAXA];
bool checkPrime(int x) {
  for (int d = 2; d * d <= x; d++) {
    if (x % d == 0) return false;
  }
  return true;
}
void calcDemand() {
  int l, r, mid;
  for (int i = 0; i < primes1.size(); i++) {
    long long product = 1, sum = 0;
    while (product <= a[n - 1]) {
      if (product > a[n - 1] / primes1[i] + 1) break;
      product *= primes1[i];
      sum = product;
      while (sum <= a[n - 1]) {
        primes1Demand[i] += bigger[sum];
        sum += product;
      }
    }
  }
}
bool check(long long x) {
  for (int i = 0; i < primes1.size(); i++) {
    long long product = 1, sum = 0, found = 0;
    while (product <= x) {
      if (product > x / primes1[i] + 1) break;
      product *= primes1[i];
      found += x / product;
    }
    if (found < primes1Demand[i]) return false;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long l, r, mid;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    bigger[a[i]]++;
  }
  sort(a, a + n);
  for (int i = MAXA - 5; i >= 0; i--) {
    prime[i] = true;
    bigger[i] += bigger[i + 1];
  }
  for (int i = 2; i <= a[n - 1]; i++) {
    if (prime[i] == false) continue;
    for (int j = 2 * i; j <= a[n - 1]; j += i) {
      prime[j] = false;
    }
  }
  for (int i = 2; i <= a[n - 1]; i++) {
    if (prime[i] == true) {
      primes1.push_back(i);
      primes1Demand.push_back(0);
    }
  }
  calcDemand();
  l = 1;
  r = inf;
  while (l + 1 < r) {
    mid = (l + r) / 2;
    if (check(mid) == true)
      r = mid;
    else
      l = mid + 1;
  }
  if (check(l) == true)
    cout << l << '\n';
  else
    cout << r << '\n';
}