N = gets.to_i
A = [0] + gets.split.map(&:to_i)

l = Array.new(N+2, 0)
r = Array.new(N+2, 0)
1.upto(N) do |i|
  l[i] = l[i-1].gcd(A[i])
end
N.downto(1) do |i|
  r[i] = r[i+1].gcd(A[i])
end

ans = []
1.upto(N) do |i|
  ans << l[i-1].gcd(r[i+1])
end
puts ans.max
