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 JAVA):

Solution:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;


public class E300
{
    static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    static PrintWriter out = new PrintWriter(System.out);
    
    static int nextInt() throws Exception {
        in.nextToken();
        return (int)in.nval;
    }
    
    static String nextString() throws Exception {
        in.nextToken();
        return in.sval;
    }
    
    public static void main(String[] args) throws Exception {
        int M = 1;
        int n = nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
            if (a[i] > M) M = a[i];
        }
        int[] cnt = new int[M+1];
        for (int i = 0; i < n; i++) cnt[a[i]]++;
        for (int i = M-1; i >= 0; i--) cnt[i] += cnt[i+1];
        long[] tot = new long[M+1];
        List<Integer> primes = new ArrayList<Integer>();
        boolean[] isPrime = new boolean[M+1];
        Arrays.fill(isPrime, true);
        isPrime[0] = isPrime[1] = false;
        for (int i = 2; i <= M; i++) if (isPrime[i]) {
            primes.add(i);
            for (int j = i+i; j <= M; j += i) isPrime[j] = false;
            int x = i;
            while (true) {
                for (int j = x; j <= M; j += x) {
                    tot[i] += cnt[j];
                }
                if (x > M/i) break;
                x *= i;
            }
        }
        
        long ans = 1;
        for (int p : primes) {
            long cur = get(tot[p], p);
            if (cur > ans) ans = cur;
        }
        
        out.println(ans);
        out.flush();
    }
    
    static long get(long tot, int p) {
        long lo = p, hi = p*tot;
        while (lo < hi) {
            long mid = (lo + hi)/2;
            long sum = 0, x = mid;
            while (x > 0) {
                x /= p;
                sum += x;
            }
            if (sum >= tot) hi = mid;
            else lo = mid + 1;
        }
        return hi;
    }
}