def gcd(a,b)
    a,b = b,a%b while b > 0
    a
end


n = gets.chomp.to_i
a = []
a = gets.split.map(&:to_i)

#puts gcd(0,a[1])

L=[0]
for i in 0..n-1
 t = gcd(a[i],L[-1])
 L.push(t)
end
L.push(0)
#puts L

R=[0]
for i in 0..n-1
 t = gcd(a[n-1-i],R[-1])
 R.push(t)
end
R.push(0)
#puts R

m = []
for i in 0..n
 t = gcd(L[i],R[n-i-1])
 #print L[i]
 #puts R[n-i-1]
 m.push(t)
end
 #puts m
 puts m.max
 
#p L
#p R
#p m