n = gets.to_i
as = gets.split.map(&:to_i)
tmp = Hash.new()

as.each.with_index do |a,i|
  if i == 0
    tmp[i] = {l: 0}
  elsif i == 1
    tmp[i] = {l: as[0]}
  elsif i == 2
    tmp[i] = {l: as[1].gcd(as[0])}
  else
    tmp[i] = {l: tmp[i-1][:l].gcd(tmp[i-2][:l])}
  end
end

(n-1).downto(0) do |i|
  if i == n-1
    tmp[i][:r] = 0
  elsif i == n-2
    tmp[i][:r] = as[i+1]
  elsif i == n-3
    tmp[i][:r] = as[i+1].gcd(as[i+2])
  else
    tmp[i][:r] = tmp[i+1].gcd(tmp[i+2])
  end
end

ans = 0
n.times do |i|
  gcd = tmp[i][:l].gcd(tmp[i][:r])
  ans = [ans, gcd].max
end

puts ans
