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 long long M = 10000000;
int k, a[1 << 20], b[M + 10];
bool p[M + 10];
long long solve() {
  for (int i = (int)(0); i < (int)(k); i++) b[a[i]]++;
  for (int i = M; i > 1; i--) b[i] += b[i + 1];
  long long ans = 0;
  p[0] = p[1] = 1;
  for (int i = (int)(0); i < (int)(M + 1); i++)
    if (!p[i]) {
      long long cnt = 0;
      for (int j = i + i; j <= M; j += i) p[j] = 1;
      for (long long j = i; j <= M; j *= i)
        for (long long k = j; k <= M; k += j) cnt += b[k];
      long long lb = 0, ub = M * M, mid, sum;
      while (ub - lb > 1) {
        sum = 0;
        mid = (lb + ub) / 2;
        for (long long j = i; j <= mid; j *= i) sum += mid / j;
        if (sum >= cnt)
          ub = mid;
        else
          lb = mid;
      }
      ans = max(ans, ub);
    }
  return ans;
}
void input() {
  cin >> k;
  for (int i = (int)(0); i < (int)(k); i++) cin >> a[i];
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);
  input();
  cout << solve() << endl;
  return 0;
}