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;
long long dp[10000001], expo[700000], expo_ans[700000];
vector<int> primes;
bitset<10000001> bs;
void generar() {
  bs.set();
  for (long long i = 2; i < 10000001; i++)
    if (bs[i]) {
      for (long long j = i * i; j < 10000001; j += i) bs[j] = 0;
      primes.push_back(i);
    }
}
long long maxi;
int main() {
  generar();
  maxi = 0;
  long long n, x, L = 0, R = 0;
  cin >> n;
  for (int i = (0); i < (n); i++) {
    cin >> x;
    maxi = max(maxi, x);
    R += x;
    dp[1]++;
    dp[x + 1]--;
  }
  for (int i = (2); i < (maxi + 1); i++) dp[i] += dp[i - 1];
  int tam = primes.size();
  for (int i = 0; i < tam && primes[i] <= maxi; i++) {
    x = primes[i];
    long long aux = 0;
    while (x <= maxi) {
      for (int j = x; j <= maxi; j += x) aux += dp[j];
      x = x * primes[i];
    }
    expo[i] = aux;
  }
  while (L + 1 < R) {
    long long ans = (L + R) / 2;
    bool ok = true;
    for (int i = 0; i < tam && primes[i] <= maxi; i++) {
      expo_ans[i] = 0;
      x = primes[i];
      while (x <= ans) {
        expo_ans[i] += ans / x;
        x = x * primes[i];
      }
      if (expo_ans[i] < expo[i]) {
        ok = false;
        break;
      }
    }
    if (ok)
      R = ans;
    else
      L = ans;
  }
  cout << R << endl;
  return 0;
}