def gcd(a, b)
    while b != 0 do
       c = a % b; a = b; b = c;
    end
return a
end
t = gets.to_i
input = gets.split(" ").map{|item|item.to_i}
l=[]
r=[]
ans =[]
input.push(0)

l[0]=0
r[t+1]=0

t.times{|k|
l[k+1]=gcd(l[k],input[k])
r[t-k] = gcd(r[t-k+1], input[t-k])
}
l.each_with_index{|item,num|
ans.push(gcd(item,r[num+1]))}

print ans.max