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 <class T, class T2>
inline bool chkmax(T &x, const T2 &y) {
  return x < y ? x = y, 1 : 0;
}
template <class T, class T2>
inline bool chkmin(T &x, const T2 &y) {
  return x > y ? x = y, 1 : 0;
}
const long long mod = 1e9 + 7;
template <class T>
inline void fix(T &x) {
  if (x >= mod | x <= -mod) {
    x %= mod;
  }
  if (x < 0) {
    x += mod;
  }
}
const long long MAX_N = 1e7 + 10;
vector<long long> primes;
long long cnt[MAX_N], lp[MAX_N];
void sieve() {
  lp[0] = lp[1] = 1;
  for (long long i = 2; i < MAX_N; i++) {
    if (lp[i] == 0) {
      lp[i] = i;
      primes.push_back(i);
    }
    for (auto it : primes) {
      if (it > lp[i] || it * i >= MAX_N) {
        break;
      }
      lp[it * i] = it;
    }
  }
  for (long long i = MAX_N - 1; i > 1; i--) {
    cnt[lp[i]] += (long long)(lp[i] != i) * cnt[i];
    cnt[i / lp[i]] += cnt[i];
  }
}
long long n, arr[MAX_N];
bool eval(long long x) {
  for (auto it : primes) {
    long long cpy = x;
    long long ans = 0;
    while (cpy > 0) {
      cpy /= it;
      ans += cpy;
    }
    if (ans < cnt[it]) {
      return false;
    }
  }
  return true;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  long long l = 0, r;
  for (long long i = 1; i <= MAX_N; i++) {
    while (l < n && arr[l] < i) {
      l++;
    }
    cnt[i] += n - l;
  }
  sieve();
  l = 0, r = MAX_N * MAX_N;
  while (l < r - 1) {
    long long m = (l + r) / 2ll;
    if (eval(m)) {
      r = m;
    } else {
      l = m;
    }
  }
  cout << r << "\n";
  return 0;
}