require 'prime'

n = gets.to_i
array = gets.split().map(&:to_i)

gcd_l = []
array.each.with_index do |a, i|
	if i == 0
		gcd_l[0] = array[0]
	else
		gcd_l[i] = array[i].gcd(gcd_l[i-1])
	end
end

array.reverse!
gcd_r = []
array.each.with_index do |a, i|
	if i == 0
		gcd_r[0] = array[0]
	else
		gcd_r[i] = array[i].gcd(gcd_r[i-1])
	end
end

array.reverse!
gcd_r.reverse!

result = []
(0..array.size-1).each do |i|
	result[i] =
		if i == 0
			gcd_r[i+1]
		elsif i == array.size - 1
			gcd_l[i-1]
		else
			gcd_l[i-1].gcd(gcd_r[i+1])
		end
end

p result.max
