N = gets.to_i
A = gets.split.map(&:to_i)

l = [0] * (N+1)
r = [0] * (N+1)
N.times do |i|
  l[i+1]=l[i].gcd(A[i])
end

(N-1).downto(0) do |i|
  r[i]=r[i+1].gcd(A[i])
end

ans = 0
N.times do |i|
  ans = [ans, l[i].gcd(r[i+1])].max
end
puts ans

