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

b = [A[0]]
1.upto(N - 1) do |i|
  b[i] = b[i-1].gcd A[i]
end

c = Array.new(N, 1)
i = N - 2
c[N - 1] = A[N-1]
while i >= 0
  c[i] = A[i].gcd(c[i+1])
  i-= 1
end

max = [b[N-2], c[1]].max

1.upto(N-2) do |i|
  v = b[i-1].gcd(c[i+1])
  max = [max, v].max
end
# p b
# p c
puts max
