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;
inline long long in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
inline string get() {
  char ch[2000010];
  scanf("%s", ch);
  return ch;
}
inline void read(long long *a, long long n) {
  for (long long i = 0; i < n; i++) a[i] = in();
}
template <class blank>
inline void out(blank x) {
  cout << x << "\n";
  exit(0);
}
template <class blank>
inline void smin(blank &a, blank b) {
  a = min(a, b);
}
template <class blank>
inline void smax(blank &a, blank b) {
  a = max(a, b);
}
const long long maxn = 1e7 + 10;
const long long maxm = 1e6 + 10;
const long long maxlg = 21;
const long long base = 29;
const long long mod = 1e9 + 7;
const long long INF = 1e18 + 10;
const long long SQ = 317 + 5;
long long sum, a[maxn], mini[maxn], cnt[maxn];
vector<long long> primes;
bool pr[maxn];
inline bool can(long long x) {
  for (long long i = 0; i < primes.size(); i++) {
    long long cnt = 0;
    long long tmp = x;
    while (tmp >= primes[i]) {
      tmp /= primes[i];
      cnt += tmp;
    }
    if (cnt < ::cnt[primes[i]]) return false;
  }
  return true;
}
inline void sieve() {
  pr[1] = true;
  for (long long i = 2; i < maxn; i++) {
    if (pr[i]) continue;
    primes.push_back(i);
    mini[i] = i;
    for (long long j = i * i; j < maxn; j += i) {
      smin(mini[j], i), pr[j] = true;
    }
  }
}
int32_t main() {
  memset(mini, 63, sizeof mini);
  sieve();
  long long k = in();
  read(a, k);
  for (long long i = 0; i < k; i++) cnt[a[i]]++, sum += a[i];
  for (long long i = maxn - 2; i >= 0; i--) cnt[i] += cnt[i + 1];
  for (long long i = maxn - 1; i >= 2; i--) {
    if (mini[i] != i) cnt[mini[i]] += cnt[i];
    cnt[i / mini[i]] += cnt[i];
  }
  long long low = 0, hi = sum;
  while (low + 1 < hi) {
    long long mid = (low + hi) >> 1;
    if (can(mid))
      hi = mid;
    else
      low = mid;
  }
  cout << hi << "\n";
}