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 fact_pow(long long n, long long k) {
  long long res = 0;
  while (n) {
    n /= k;
    res += n;
  }
  return res;
}
int main() {
  long long n, i, j, a, b, sum;
  sum = 0;
  static vector<long long> ig(10000002, 0);
  static vector<long long> prs(10000002, 0);
  cin >> n;
  for (i = 0; i < n; ++i) {
    scanf("%I64d", &a);
    ig[0]++;
    ig[a + 1]--;
  }
  a = 0;
  for (i = 0; i < prs.size(); ++i) {
    a += ig[i];
    prs[i] = a;
  }
  vector<int> temp;
  vector<int> q(10000002, 1);
  for (i = 2; i < q.size(); ++i) {
    if (q[i]) {
      a = i;
      for (j = a + a; j < q.size(); j += a) {
        q[j] = 0;
        if (prs[j] > 0) {
          b = j;
          long long k;
          k = 0;
          while (b && b % a == 0) {
            k++;
            b = b / a;
          }
          prs[a] += prs[j] * k;
          prs[b] += prs[j];
          prs[j] = 0;
        }
      }
      if (prs[i] > 0) {
        temp.push_back(i);
        sum = i;
      }
    }
  }
  long long ans;
  if (sum != 0) {
    sum--;
  }
  a = sum;
  b = 10000000000000000;
  if (temp.size() == 0)
    cout << 1;
  else {
    while (a + 2 <= b) {
      int ok = 1;
      ans = (a + b) / 2;
      for (i = temp.size() - 1; i >= 0; --i) {
        if (fact_pow(ans, temp[i]) < prs[temp[i]]) {
          ok = 0;
          break;
        }
      }
      if (ok) {
        b = ans;
      } else {
        a = ans;
      }
    }
    cout << b;
  }
  return 0;
}