DMAX=17

def func(x,n)
    return if n==1
    gcds=[]
    (n/2).times do |i|
        gcds[i]=x[-1][2*i].gcd(x[-1][2*i+1])
    end
    x << gcds
    func(x,n/2)
end

def func2(x,i,level,temp)
    return if level==DMAX
    t=(i>>DMAX-level-1) ^ 1
    temp << x[DMAX-level-1][t]
    func2(x,i,level+1,temp)
end


def func3(a,n)
    x1=Array.new
    x1 << a
    func(x1,2**DMAX)
    max=0
    n.times do |i|
        temp=[]
        func2(x1,i,0,temp)
        g=temp.inject(&:gcd)
        max=g if max<g
    end
    return max
end

N=gets.to_i
A=gets.split.map(&:to_i)
A2=Array.new(2**DMAX,0)
A.each_with_index do |a,i|
    A2[i]=a
end
puts func3(A2,N)