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:
// @author Sanzhar
import java.io.*;
import java.util.*;
import java.awt.Point;

public class Template {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;

    String next() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(in.readLine());
            } catch (Exception e) {
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    public void run() throws Exception {
        //in = new BufferedReader(new FileReader("input.txt"));
        //out = new PrintWriter(new FileWriter("output.txt"));
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.flush();
        out.close();
        in.close();
    }
    long[] c;
    int[] p;
    int pn;

    boolean ok(long mid) {
        boolean can = true;
        for (int i = 0; i < pn && can; i++) {
            long tmp = mid, f = 0;
            while (tmp > 0) {
                tmp /= p[i];
                f += tmp;
            }
            if (f < c[i]) {
                can = false;
            }
        }
        return can;
    }

    public void solve() throws Exception {
        int k = nextInt();
        int[] a = new int[k];
        int m = 0;
        c = new long[10000002];
        long l = 1, r = 0;
        for (int i = 0; i < k; i++) {
            a[i] = nextInt();
            m = Math.max(a[i], m);
            c[a[i]]++;
            r += a[i];
        }

        int[] lp = new int[m+1];
        p = new int[700000];
        pn = 0;
        for (int i = 2; i <= m; i++) {
            if (lp[i] == 0) {
                lp[i] = i;
                p[pn++] = i;
            }
            for (int j = 0; j < pn && p[j] <= lp[i] && (long) i * p[j] <= m; j++) {
                lp[i * p[j]] = p[j];
            }
        }
        for (int i = m; i >= 2; i--) {
            c[i] += c[i + 1];
        }
        for (int i = m; i >= 2; i--) {
            if (lp[i] != i) {
                c[lp[i]] += c[i];
            }
            c[i / lp[i]] += c[i];
        }
        for (int i = 0; i < pn; i++) {
            c[i] = c[p[i]];
        }
        while (r != l) {
            long mid = (r + l) / 2;
            if (ok(mid)) {
                r = mid;
            } else {
                l = mid + 1;
            }
        }
        out.println(r);
    }

    public static void main(String[] args) throws Exception {
        new Template().run();
    }
}