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>
const double eps = 1e-9;
const long double pi = acos(-1.0);
using namespace std;
const int N = 1e7 + 1;
int n, mx;
long long a[N], del[N];
bool p[N];
vector<int> pr;
bool check(long long x) {
  for (int i = 0; i < pr.size(); i++) {
    long long step = pr[i];
    long long y = pr[i];
    long long cnt = 0;
    while (x / step > 0) {
      cnt += x / step;
      step *= y;
    }
    if (a[pr[i]] > cnt) return false;
  }
  return true;
}
void solve() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    mx = max(mx, x);
    a[x]++;
  }
  for (int i = mx - 1; i >= 2; i--) a[i] += a[i + 1];
  for (int i = 0; i < N; i++) p[i] = true;
  p[0] = p[1] = false;
  for (int i = 2; i < N; i++) {
    if (p[i]) {
      del[i] = i;
      if (i * 1ll * i < N) {
        for (int j = i * i; j < N; j += i) {
          p[j] = false;
          del[j] = i;
        }
      }
    }
  }
  for (int i = mx; i >= 2; i--) {
    if (del[i] != i) {
      a[del[i]] += a[i];
      a[i / del[i]] += a[i];
      a[i] = 0;
    } else {
      pr.push_back(i);
    }
  }
  long long l = 0;
  long long r = 1e13;
  while (r - l > 1) {
    long long m = (l + r) >> 1;
    if (check(m))
      r = m;
    else
      l = m;
  }
  cout << l + 1 << endl;
}
int main() {
  ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
  cout.setf(ios::fixed), cout.precision(10);
  int step;
  step = 1;
  for (int i = 1; i <= step; i++) {
    solve();
  }
}