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 int inf = 1e9 + 10;
const long long INF = 1e18;
const int maxk = 1e6 + 5;
const int maxn = 1e7 + 5;
const int mod = 1e9 + 7;
int k;
int a[maxk];
long long cnt[maxn];
bool is_prime[maxn];
int nprimes;
int primes[maxn];
void sieve(int n) {
  fill(is_prime, is_prime + n + 1, true);
  is_prime[0] = is_prime[1] = false;
  for (int i = 2; i <= n; ++i) {
    if (is_prime[i]) {
      primes[nprimes++] = i;
      for (int j = 2 * i; j <= n; j += i) {
        is_prime[j] = false;
        if (cnt[j]) {
          int tmp = j, f = 0;
          while (tmp % i == 0) {
            tmp /= i;
            ++f;
          }
          cnt[i] += 1LL * f * cnt[j];
          cnt[tmp] += cnt[j];
          cnt[j] = 0;
        }
      }
    }
  }
}
bool check(long long x) {
  for (int i = 0; i < nprimes; ++i) {
    long long tmp = x, f = 0;
    while (tmp) {
      tmp /= primes[i];
      f += tmp;
    }
    if (f < cnt[primes[i]]) return false;
  }
  return true;
}
int MAIN() {
  scanf("%d", &k);
  int mx = -1;
  long long lf = 0, rg = 0;
  for (int i = 0; i < k; ++i) {
    scanf("%d", &a[i]);
    mx = max(mx, a[i]);
    rg += a[i];
    ++cnt[a[i]];
  }
  for (int i = mx - 1; i >= 1; --i) cnt[i] += cnt[i + 1];
  sieve(mx);
  while (lf + 1 < rg) {
    long long mid = (lf + rg) >> 1;
    if (check(mid))
      rg = mid;
    else
      lf = mid;
  }
  printf("%I64d\n", rg);
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  cout << fixed << setprecision(16);
  int ret = MAIN();
  return ret;
}