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;
static const int INF = 500000000;
template <class T>
void debug(T a, T b) {
  for (; a != b; ++a) cerr << *a << ' ';
  cerr << endl;
}
int n;
int ar[1000005];
int table[10000005];
long long int prime[1000005], cnt;
long long int count(long long int t, int b) {
  long long int expo2 = 0;
  while (t > 0) {
    expo2 += t / b;
    t /= b;
  }
  return expo2;
}
int sum[10000005];
long long int get(long long int p) {
  long long int expo = 0;
  for (int j = p; j <= 10000000; j += p) {
    int nxt = p + j;
    expo += (sum[min(nxt, 10000002)] - sum[j]) * (long long int)(j / p);
  }
  return expo;
}
int main() {
  memset(table, -1, sizeof(table));
  table[0] = table[1] = 0;
  for (int i = 2; i * i <= 10000000; ++i)
    if (table[i]) {
      for (int j = i * i; j <= 10000000; j += i) table[j] = 0;
    }
  for (int i = 0; i < 10000000; ++i)
    if (table[i]) {
      prime[cnt++] = i;
    }
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", &ar[i]);
  for (int i = 0; i < n; ++i) {
    ++sum[ar[i] + 1];
  }
  for (int i = 0; i < 10000002; ++i) sum[i + 1] += sum[i];
  long long int res = 1;
  int first = 1;
  for (int i = 0; i < cnt; ++i) {
    long long int expo = 0;
    long long int base = prime[i];
    while (base <= 10000000) {
      expo += get(base);
      base *= prime[i];
    }
    if (count(res, prime[i]) < expo) {
      long long int lb = 0, ub = 1e15;
      while (ub - lb > 1) {
        long long int md = (lb + ub) >> 1;
        if (count(md, prime[i]) < expo)
          lb = md;
        else
          ub = md;
      }
      res = max(res, ub);
    }
  }
  cout << res << endl;
  return 0;
}