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 size = 10000000;
int Index, maxPrime;
int vis[size + 10];
int prime[size];
long long cnt[size + 10];
void init() {
  Index = 0;
  memset(vis, 0, sizeof(vis));
  vis[1] = 1;
  for (int i = 2; i <= size; i++) {
    if (!vis[i]) {
      prime[Index++] = i;
      vis[i] = i;
      for (int j = i * 2; j <= size; j += i) {
        vis[j] = i;
      }
    }
  }
}
bool bSearch(long long var) {
  long long ans, temp;
  for (int i = 0; i < Index && prime[i] <= maxPrime; i++) {
    ans = 0;
    temp = prime[i];
    if (!cnt[prime[i]]) continue;
    while (var >= temp) {
      ans += var / temp;
      temp *= prime[i];
    }
    if (ans < cnt[prime[i]]) return false;
  }
  return true;
}
int main() {
  cin.sync_with_stdio(false);
  init();
  long long R, L, M, sum;
  int num, n, maxNum;
  cin >> n;
  maxNum = maxPrime = 0;
  sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> num;
    ++cnt[num];
    maxNum = max(maxNum, num);
    sum += 1LL * num;
  }
  for (int i = maxNum - 1; i >= 2; i--) {
    cnt[i] += cnt[i + 1];
  }
  for (int i = maxNum; i >= 1; i--) {
    if (vis[i] == i) {
      maxPrime = max(maxPrime, i);
      continue;
    }
    cnt[vis[i]] += cnt[i];
    cnt[i / vis[i]] += cnt[i];
  }
  L = 1, R = sum;
  while (L < R) {
    M = (L + R) / 2;
    if (bSearch(M))
      R = M;
    else
      L = M + 1;
  }
  cout << L << endl;
  return 0;
}