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 int MAX = 11000111;
int n, a[1000111], sieve[MAX];
long long need[MAX];
int primes[MAX], nPrime;
void init() {
  for (int i = (2), _b = (4000); i <= _b; i++)
    if (!sieve[i]) {
      for (int j = i * i; j < MAX; j += i) sieve[j] = i;
    }
  nPrime = 0;
  for (int i = (2), _b = (MAX - 1); i <= _b; i++)
    if (!sieve[i]) primes[++nPrime] = i;
}
long long get(int p, long long n) {
  if (n < p) return 0;
  return n / p + get(p, n / p);
}
bool check(long long x) {
  for (int i = (1), _b = (nPrime); i <= _b; i++)
    if (get(primes[i], x) < need[primes[i]]) return false;
  return true;
}
int has[MAX];
int main() {
  init();
  while (scanf("%d", &n) == 1) {
    memset(has, 0, sizeof has);
    for (int i = (1), _b = (n); i <= _b; i++) {
      scanf("%d", &a[i]);
      has[a[i]] += 1;
    }
    for (int i = (MAX - 2), _b = (1); i >= _b; i--) has[i] += has[i + 1];
    memset(need, 0, sizeof need);
    int ln = *max_element(a + 1, a + n + 1);
    for (int i = (2), _b = (ln); i <= _b; i++) {
      int u = i;
      while (u > 1) {
        int p = sieve[u] ? sieve[u] : u;
        while (u % p == 0) {
          u /= p;
          need[p] += has[i];
        }
      }
    }
    long long l = 1, r = 1e14, res = r;
    while (l <= r) {
      long long mid = (l + r) >> 1LL;
      if (check(mid)) {
        res = mid;
        r = mid - 1;
      } else
        l = mid + 1;
    }
    cout << res << endl;
  }
  return 0;
}