There are N integers, A_1, A_2, ..., A_N, written on the blackboard.

You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written.

Find the maximum possible greatest common divisor of the N integers on the blackboard after your move.

Constraints

* All values in input are integers.
* 2 \leq N \leq 10^5
* 1 \leq A_i \leq 10^9

Output

Input is given from Standard Input in the following format:


N
A_1 A_2 ... A_N

Output

Print the maximum possible greatest common divisor of the N integers on the blackboard after your move.

Examples

Input

3
7 6 8


Output

2


Input

3
12 15 18


Output

6


Input

2
1000000000 1000000000


Output

1000000000
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(stdR.readLine());
        String[] s = stdR.readLine().split(" ");
        int[] A = new int[N];
        for(int i = 0 ; i < N ; i++) {
            A[i] = Integer.parseInt(s[i]);
        }
        if(N == 2) {
            System.out.println(Math.max(A[0], A[1]));
        }else if(N == 3) {
            System.out.println(Math.max(Math.max(gcd(A[0],A[2]),gcd(A[0],A[1])), gcd(A[1],A[2])));
        }else {
            int[] front = new int[N - 1];
            front[0] = gcd(A[0],A[1]);
            int[] back = new int[N - 1];
            back[0] = gcd(A[A.length - 2], A[A.length - 1]);
            for(int i = 1 ; i < N - 1 ; i++) {
                front[i] = gcd(front[i - 1], A[i + 1]);
                back[i] = gcd(back[i - 1], A[A.length - i - 2]);
            }
            int max = back[N - 3];//0
            for(int i = 1 ; i < N  ; i++) {
                if(i == 1) {
                    max = Math.max(max, gcd(A[0], back[N - 3 - i]));
                }else if(i == N - 1) {
                    max = Math.max(max, front[N - 3]);
                }else if(i == N - 2){
                    max = Math.max(max, gcd(A[N - 1], front[N - 4]));
                }else {
                    max = Math.max(max, gcd(front[i - 2], back[N - 3 - i]));
                }
            }
            System.out.println(max);
        }
    }
    
    private static int gcd(int m, int n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }
}
