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;
long long P[10000005];
long long is[10000005];
vector<pair<long long, long long> > ss;
long long solve(long long x) {
  long long ch = 1;
  for (long long i = 0; i < ss.size(); i++) {
    long long a = ss[i].first;
    long long b = ss[i].second;
    long long sum = 0;
    for (long long y = a; y <= x; y *= a) {
      sum += x / y;
    }
    if (sum < b) return 0;
  }
  return 1;
}
signed main() {
  long long k;
  cin >> k;
  for (long long i = 0; i < k; i++) {
    long long a;
    cin >> a;
    P[a]++;
  }
  for (long long i = 2; i < 10000005; i++) {
    if (is[i] == 0) {
      for (long long j = i * 2; j < 10000005; j += i) {
        is[j] = 1;
      }
    }
  }
  for (long long i = 10000005 - 1; i >= 2; i--) {
    P[i] = P[i + 1] + P[i];
  }
  for (long long i = 2; i < 10000005; i++) {
    if (is[i] == 1) continue;
    long long val = P[i];
    P[i] = 0;
    for (long long j = i; j < 10000005; j *= i) {
      for (long long l = j; l < 10000005; l += j) {
        P[i] += P[l];
      }
    }
    P[i] += val;
    if (P[i] > 0) ss.push_back(make_pair(i, P[i]));
  }
  long long l = 1, r = 100000000000000;
  long long ans = 0;
  while (r >= l) {
    long long mid = (l + r) / 2LL;
    if (solve(mid) == 1) {
      r = mid - 1;
      ans = mid;
    } else
      l = mid + 1;
  }
  cout << ans << endl;
}