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 n, x, mx, p[10000010], prime[10000010], cnt;
long long f[10000010], l, r, mid, ans;
inline int read() {
  register int x = 0, ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x;
}
inline void shake() {
  for (register int i = 2; i <= 10000000; i++) {
    if (!p[i]) prime[++cnt] = i;
    for (register int j = 1; j <= cnt && i * prime[j] <= 10000000; j++) {
      p[i * prime[j]] = prime[j];
      if (i % prime[j] == 0) break;
    }
  }
}
inline bool check(long long x) {
  for (register int i = 1; i <= cnt; i++) {
    register long long temp = x, tot = 0;
    while (temp) tot += temp /= prime[i];
    if (f[prime[i]] > tot) return 0;
  }
  return 1;
}
int main() {
  shake();
  n = read();
  for (register int i = 1; i <= n; i++)
    f[x = read()]++, mx = max(x, mx), r += x;
  for (register int i = mx; i; i--) f[i - 1] += f[i];
  for (register int i = mx; i; i--)
    if (p[i]) {
      f[p[i]] += f[i];
      f[i / p[i]] += f[i];
    }
  while (l <= r) {
    mid = (l + r) >> 1;
    if (check(mid))
      r = mid - 1, ans = mid;
    else
      l = mid + 1;
  }
  cout << max(1ll, ans) << endl;
  return 0;
}