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.*;
import java.util.*;

/**
 * Created by Katushka on 11.03.2020.
 */
public class Main {

    static int[] readArray(int size, InputReader in, boolean substractOne) {
        int[] a = new int[size];
        for (int i = 0; i < size; i++) {
            a[i] = in.nextInt() - (substractOne ? 1 : 0);
        }
        return a;
    }

    static long[] readLongArray(int size, InputReader in) {
        long[] a = new long[size];
        for (int i = 0; i < size; i++) {
            a[i] = in.nextLong();
        }
        return a;
    }

    static double[] readDoubleArray(int size, InputReader in) {
        double[] a = new double[size];
        for (int i = 0; i < size; i++) {
            a[i] = in.nextLong();
        }
        return a;
    }

    private static final long MOD = 1000000007;

    static int[] sieveOfEuler(int size, List<Integer> primes) {
        int[] lp = new int[size];

        lp[1] = 1;

        for (int j = 2; j < lp.length; ++j) {
            if (lp[j] == 0) {
                lp[j] = j;
                primes.add(j);
            }
            for (Integer p : primes) {
                if (p > lp[j] || p * j >= size) {
                    break;
                }
                lp[p * j] = p;
            }
        }
        return lp;
    }

    static void sortArray(int[] a) {
        Random random = new Random();

        for (int i = 0; i < a.length; i++) {
            int randomPos = random.nextInt(a.length);
            int t = a[i];
            a[i] = a[randomPos];
            a[randomPos] = t;
        }
        Arrays.sort(a);
    }

    public static void main(String[] args) throws FileNotFoundException {
//        InputReader in = new InputReader(new FileInputStream("route.in"));
//        PrintWriter out = new PrintWriter(new BufferedOutputStream(new FileOutputStream("route.out")));

        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

        int k = in.nextInt();

        int[] a = readArray(k, in, false);
        sortArray(a);
        long sum = 0;
        int max = a[k - 1];
        for (int i = 0; i < k; i++) {
            sum += a[i];
        }
        List<Integer> primes = new ArrayList<>();
        int[] sieve = sieveOfEuler(max + 2, primes);
        long[] primePower = new long[max + 1];

        int j = k - 1;
        for (int i = max; i >= 2; i--) {
            while (j > 0 && a[j - 1] >= i) {
                j--;
            }
            primePower[i] = k - j;
        }


        for (int i = max; i >= 2; i--) {
            if (sieve[i] != i) {
                primePower[sieve[i]] += primePower[i];
                primePower[i / sieve[i]] += primePower[i];
            }

        }

        long r = sum;
        long l = 0;
        while (r - l > 1) {
            long m = (r + l) / 2;
            if (check(m, primePower, primes)) {
                r = m;
            } else {
                l = m;
            }
        }
        out.println(r);

        out.close();
    }

    private static boolean check(long ans, long[] primePower, List<Integer> primes) {
        for (int j = 0; j < primes.size(); j++) {
            int prime = primes.get(j);
            if (prime >= primePower.length) {
                break;
            }
            long p = prime;
            long cnt = 0;
            while (p <= ans) {
                cnt += ans / p;
                p *= prime;
            }
            if (cnt < primePower[prime]) {
                return false;
            }
        }
        return true;
    }

    private static void outputArray(int[] ans, PrintWriter out) {
        StringBuilder str = new StringBuilder();
        for (long an : ans) {
            str.append(an).append(' ');
        }
        out.println(str);
    }

    private static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                createTokenizer();
            }
            return tokenizer.nextToken();
        }

        private void createTokenizer() {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public String nextWord() {
            return next();
        }

        public String nextString() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

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

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

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

        public char nextChar() {
            return next().charAt(0);
        }

        public int[] nextInts() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                createTokenizer();
            }
            List<Integer> res = new ArrayList<>();
            while (tokenizer.hasMoreElements()) {
                res.add(Integer.parseInt(tokenizer.nextToken()));
            }
            int[] resArray = new int[res.size()];
            for (int i = 0; i < res.size(); i++) {
                resArray[i] = res.get(i);
            }
            return resArray;
        }
    }
}