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_N = 1e6;
const int MAX_A = 1e7 + 5;
long long P[MAX_A];
int A[MAX_N], n;
int ok[MAX_A];
int prime[700000], num = 0;
void prime_init() {
  num = 0;
  for (int i = 2; i <= 1e7; i++)
    if (ok[i] == 0) {
      prime[num++] = i;
      int j = i;
      while (j <= 1e7) {
        if (ok[j] == 0) ok[j] = i;
        j += i;
      }
    }
}
void input() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &A[i]);
}
void init() {
  for (int i = 0; i < n; i++) P[A[i]]++;
  for (int i = 1e7; i > 1; i--) P[i] += P[i + 1];
  P[1] = 0;
  for (int i = 1e7; i > 1; i--)
    if (P[i]) {
      int tmp = ok[i];
      if (tmp == i) continue;
      P[i / tmp] += P[i];
      P[tmp] += P[i];
    }
}
bool meet(long long k) {
  for (int i = 0; i < num; i++) {
    long long tmp = k;
    long long c = 0;
    while (tmp /= prime[i]) c += tmp;
    if (c < P[prime[i]]) return 0;
  }
  return 1;
}
void solve() {
  long long r = 0, l = 0;
  for (int i = 0; i < n; i++) r += 1ll * A[i];
  while (l + 1 < r) {
    long long mid = (l + r) / 2;
    if (meet(mid))
      r = mid;
    else
      l = mid;
  }
  cout << r;
}
int main() {
  prime_init();
  input();
  init();
  solve();
  return 0;
}