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;
int dv[10000001];
long long cnt[10000001];
long long need[10000001];
void run(int casenr) {
  memset(dv, -1, sizeof(dv));
  for (int i = (2); i <= (10000000); ++i)
    if (dv[i] == -1)
      for (int j = i; j <= 10000000; j += i)
        if (dv[j] == -1) dv[j] = i;
  int k;
  scanf("%d", &k);
  for (int i = (0); i < (k); ++i) {
    int a;
    scanf("%d", &a);
    ++cnt[a];
  }
  long long ret = 1;
  long long sum = 0;
  for (int i = 10000000; i >= 2; --i) {
    sum += cnt[i];
    long long cur = sum + need[i];
    if (cur == 0) continue;
    if (dv[i] != i) {
      need[dv[i]] += cur;
      need[i / dv[i]] += cur;
    } else {
      long long now = 0, left = cur, have = 1, val = i;
      int exp = 1;
      while (have < left) {
        have = have * i + 1;
        val *= i;
        ++exp;
      }
      while (left > 0) {
        if (have - exp >= left) {
          have = (have - 1) / i;
          val /= i;
          --exp;
          continue;
        }
        long long times = (left + exp - have + have - 1) / have;
        left -= times * have;
        now += times * val;
      }
      if (now > ret) ret = now;
    }
  }
  cout << ret << endl;
}
int main() {
  run(1);
  return 0;
}