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 MAXN = 10001001;
int min_div[MAXN];
vector<long long> primes;
void criba() {
  for (int i = (int)0; i < (int)MAXN; i++) min_div[i] = i;
  for (int i = (int)2; i < (int)MAXN; i++) {
    if (min_div[i] != i) continue;
    primes.push_back(i);
    for (int j = i + i; j < MAXN; j += i) {
      min_div[j] = i;
    }
  }
}
void solve(long long* acum) {
  long long now = acum[MAXN - 1];
  for (int i = MAXN - 2; i > 1; i--) {
    now += acum[i];
    acum[i] = now;
  }
  for (int i = MAXN - 1; i > 1; i--)
    if (acum[i]) {
      if (min_div[i] == i) continue;
      int a = min_div[i];
      int b = i / min_div[i];
      acum[a] += acum[i];
      acum[b] += acum[i];
      acum[i] = 0;
    }
}
long long acum_a[MAXN];
bool test(long long n) {
  for (int i = (int)0; i < (int)primes.size(); i++) {
    long long e = 0;
    long long n_t = n;
    while (n_t) {
      e += (n_t /= (long long)primes[i]);
    }
    if (e < acum_a[primes[i]]) return false;
  }
  return true;
}
int main() {
  criba();
  int k;
  scanf("%d", &k);
  long long lo = 1, hi = 0;
  for (int i = (int)0; i < (int)k; i++) {
    int n = 1000101;
    scanf("%d", &n);
    acum_a[n]++;
    hi += n;
  }
  solve(acum_a);
  while (lo < hi) {
    long long mid = (lo + hi) / 2LL;
    if (test(mid)) {
      hi = mid;
    } else {
      lo = mid + 1;
    }
  }
  cout << lo << endl;
  return 0;
}