#include<bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using namespace::std;
namespace mp = boost::multiprecision;
typedef long long lint;
typedef long double ldouble;
typedef vector<lint> vec;
typedef vector<vector<lint>> mat;
#define rep(i, n) for(lint i = 0; i < (lint)(n); i++)
#define irep(i) for(lint i = 0;; i++)
#define irep1(i) for(lint i = 1;; i++)
#define irep2(i) for(lint i = 2;; i++)
#define rrep(i, n) for(lint i = (lint)(n-1); i >-1; i--)
#define repi(i,a,b) for(lint i=lint(a);i<lint(b);i++)
#define rep2(i,a,b,c) for(lint i=lint(a);i>lint(b);i+=c)
#define all(x) (x).begin(),(x).end()
#define sl(c) (('a')<=(c)&&(c)<=('z'))
#define ll(c) (('A')<=(c)&&(c)<=('Z'))
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define PI 3.141592653589793
#define cout (cout<<fixed<<setprecision(15))
#define makeupper(t) (transform(all(t),t.begin(),::toupper))
#define makelower(t) (transform(all(t),t.begin(),::tolower))
#define dist(x1,y1,x2,y2) (pow(pow(x2-x1,2)+pow(y2-y1,2),0.5))
#define NEXT_LINE string junk; getline(cin, junk);
#define output(v) do{rep(i,v.size())cout<<(i?" ":"")<<v[i];cout<<"\n";}while(0)
//#define output(v,s) do{rep(i,v.size())cout<<(i?s:"")<<v[i];cout<<"\n";}while(0)
#define output2(v) rep(i,v.size()){rep(j,v[i].size()){cout<<(j?" ":"")<<v[i][j];}cout<<"\n";}
#define INF 1<<30
#define LINT_MAX 9223372036854775807
#define MOD 1000000007
vector<lint> dx={-1,1,0,0};
vector<lint> dy={0,0,-1,1};
vector<lint> operator+(const vector<lint>& v1,const vector<lint>& v2){
    vector<lint> v(v1.size()+v2.size(),0);
    rep(i,v1.size())v[i]=v1[i];
    rep(i,v2.size())v[i+v1.size()]=v2[i];
    return v;
}
inline lint sum(vector<lint> v){
    lint sum=0;
    rep(i,v.size())sum+=v[i];
    return sum;
}
inline string replace(string str, string before, std::string after) {
	string::size_type  Pos(str.find(before));
	while (Pos != std::string::npos) {
		str.replace(Pos, before.length(), after);
		Pos = str.find(before, Pos + after.length());
	}
	return str;
}
inline vector<string> split(string s, string delim) {
	vector<string> elems;
	s=replace(s, "#", "HASH");
	s=replace(s, delim,"#");
	stringstream ss(s);
	string item;
	while (getline(ss, item, '#')) {
		elems.push_back(replace(item, "HASH", "#"));
	}
	return elems;
}
inline vector<int> cross(vector<int> a, vector<int> b) {
    return { a[1] * b[2] - a[2] * b[1],a[2] * b[0] - a[0] * b[2],a[0] * b[1] - a[1] * b[0] };
}
inline lint GCD(lint a,lint b){return b?GCD(b,a%b):a;}
inline vector<lint> primeList(lint n) {
    vector<bool> p(n+1);
    vector<lint> list;
    repi(i,1, n+1)p[i] = true;
    repi(i,2,sqrt(n)+1) {
        if (p[i]) {
            repi(j,2,n/i+1) {
                p[i*j] = false;
            }
        }
    }
    repi(i, 2, n+1)if (p[i])list.push_back(i);
    return list;
}
inline bool isPrime(int num){
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2){
        if (num % i == 0)return false;
    }
    return true;
}
inline lint max(vector<lint> num){
    lint M=num[0];
    rep(i,num.size())M=max(M,num[i]);
    return M;
}
inline lint min(vector<lint> num){
    lint M=num[0];
    rep(i,num.size())M=min(M,num[i]);
    return M;
}
template<typename T>class Stack{
    vector<T> stack;
    public:
        void push(T num) {
            stack.push_back(num);
        }
        T pop() {
            T num = stack[stack.size() - 1];
            stack.erase(stack.end() - 1);
            return num;
        }
        bool empty(){
            return stack.empty();
        }
};
template<typename T>class Queue{
    deque<T> queue;
    public:
        void push(T num) {
            queue.push_front(num);
        }
		void push_back(T num){
			queue.push_back(num);
		}
        T pop() {
            T num = queue[queue.size()-1];
            queue.pop_back();
            return num;
        }
        bool empty(){
            return queue.empty();
        }
};
inline lint signal(lint val){
    if(val==0)return 0;
    else return val/abs(val);
}
inline vector<lint> bit(lint n){
    vector<lint> v(log2(n)+1);
    rep(i,v.size()){
        v[i]=n%2;
        n/=2;
    }
    reverse(all(v));
    return v;
}
inline void bit(lint n,vector<lint>& v){
    rep(i,v.size()){
        v[i]=n%2;
        n/=2;
    }
    reverse(all(v));
}
inline lint btol(vector<lint> bit){
    lint n=0;
    rep(i,bit.size()){
        n=n*2+bit[i];
    }
    return n;
}
inline mp::cpp_int comb(lint a,lint b){
    mp::cpp_int ans=1;
    rep(i,b){ans*=a-i;}
    rep(i,b){ans/=i+1;}
    return ans;
}
inline void factorization(lint m,vector<lint>& v,vector<lint>& v2){
        irep2(i){
        lint a=0;
        if(m==1)break;
        if(m%i==0)v.push_back(i);
        while(1){
            if(m%i==0){
                a++;
                m/=i;
            }else{
                if(a>0)v2.push_back(a);
                break;
            }
        }
    }
}
struct SegmentTree{
    private:
        lint n;
        vector<lint> node;
        lint init=0;
    public:
        SegmentTree(vector<lint>v){
            n=pow(2,ceill(log2(v.size())));
            node.resize(n*2-1,init);
            rep(i,v.size())node[i+n-1] = v[i];
            rrep(i,n-1)node[i]=proc(node[2*i+1],node[2*i+2]);
        }
        void update(lint x,lint val){
            x+=(n-1);
            node[x]=val;
            while(x>0){
                x=(x-1)/2;
                node[x]=proc(node[x*2+1],node[x*2+2]);
            }
        }
        lint get(lint a,lint b){
            return query(a,b,0,0,n);
        }
        lint query(lint a,lint b,lint k,lint l,lint r){
            if(r<=a||b<=l)return init;
            if(a<=l&&r<=b)return node[k];
            else{
                lint vl=query(a,b,k*2+1,l,(l+r)/2);
                lint vr=query(a,b,k*2+2,(l+r)/2,r);
                return proc(vl,vr);
            }
        }
        lint proc(lint a,lint b){
            return GCD(a,b);
        }
};
int main() {
    lint n;
    cin>>n;
    vector<lint>v(n);
    rep(i,n)cin>>v[i];
    SegmentTree st=SegmentTree(v);
    lint M=0;
    rep(i,n){
        M=max(M,GCD(st.get(0,i),st.get(i+1,v.size())));
    }
    cout<<M;
}

Measured memory_bytes: 3840