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 Get() {
  char c;
  while (c = getchar(), c < '0' || c > '9')
    ;
  int X = 0;
  while (c >= '0' && c <= '9') {
    X = X * 10 + c - 48;
    c = getchar();
  }
  return X;
}
int Total;
int Prime[10000000];
long long Count[10000000];
long long Check(long long X) {
  for (int i = 0; i < Total; i++) {
    long long Sum = 0, T = X;
    while (T) {
      Sum += T / Prime[i];
      T /= Prime[i];
    }
    if (Sum < Count[i]) return false;
  }
  return true;
}
int main() {
  int N = Get();
  static int A[1000000];
  for (int i = 0; i < N; i++) A[i] = Get();
  sort(A, A + N);
  static bool Flag[10000001];
  static int Min[10000001];
  memset(Flag, 0, sizeof(Flag));
  Total = 0;
  for (int i = 2; i <= 10000000; i++) {
    if (!Flag[i]) {
      Min[i] = Total;
      Prime[Total++] = i;
    }
    for (int j = 0; j < Total && i * Prime[j] <= 10000000; j++) {
      Flag[i * Prime[j]] = true;
      Min[i * Prime[j]] = j;
      if (!(i % Prime[j])) break;
    }
  }
  static long long Delta[10000001];
  for (int i = 10000000, j = N; i >= 2; i--) {
    while (j && A[j - 1] >= i) j--;
    Delta[i] = N - j;
  }
  memset(Count, 0, sizeof(Count));
  for (int i = 10000000; i >= 2; i--) {
    Count[Min[i]] += Delta[i];
    Delta[i / Prime[Min[i]]] += Delta[i];
  }
  long long Left = 1, Right = 0;
  for (int i = 0; i < N; i++) Right += A[i];
  while (Left < Right) {
    long long Mid = (Left + Right) / 2;
    if (Check(Mid))
      Right = Mid;
    else
      Left = Mid + 1;
  }
  cout << Left << endl;
  return 0;
}