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 era[10001000];
long long prime[10001000 / 10];
long long powerD[10001000];
long long pwrD[10001000 / 10];
long long primenum;
void makeera() {
  era[0] = -1;
  era[1] = -1;
  for (long long i = 0; i < 10001000; i++) era[i] = 1;
  long long eemax = sqrt(10001000);
  for (long long i = 2; i < eemax; i++)
    if (era[i] == 1)
      for (long long j = i * i; j < 10001000; j += i) era[j] = i;
  for (long long i = 2; i < 10001000; i++)
    if (era[i] == 1) prime[primenum++] = i;
}
long long s = 0;
inline long long factor(long long a, long long p) {
  s = 0;
  while (a) {
    s += a / p;
    a /= p;
  }
  return s;
}
long long maxa = 1;
long long maxp = 0;
void checkfactor() {
  for (long long i = maxa; i > 1; i--)
    if (era[i] != 1) {
      powerD[era[i]] += powerD[i];
      powerD[i / era[i]] += powerD[i];
      powerD[i] = 0;
    }
  for (long long i = 2; i <= maxa; i++)
    if (powerD[i]) pwrD[maxp++] = powerD[i];
}
bool check(long long a) {
  for (long long i = maxp - 1; i >= 0; i--)
    if (factor(a, prime[i]) < pwrD[i]) return false;
  return true;
}
long long bin(long long l, long long r) {
  if (r - l == 1) return r;
  if (check((l + r) / 2))
    return bin(l, (l + r) / 2);
  else
    return bin((l + r) / 2, r);
}
int main() {
  long long n, a;
  long long s = 0;
  n = 1000000;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    a = (rand() * rand()) % 10000000;
    cin >> a;
    s += a;
    powerD[a]++;
    if (maxa < a) maxa = a;
  }
  if (maxa == 1) {
    cout << 1;
    return 0;
  }
  for (long long i = maxa; i > 1; i--) powerD[i - 1] += powerD[i];
  makeera();
  checkfactor();
  cout << bin(1, s);
  return 0;
}