INF = 10000000000

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

lefts = []
accum = 0
as.each_with_index do |a|
  lefts.push(accum)
  accum = accum.gcd(a)
end

rights = []
accum = 0
as.reverse_each do |a|
  rights.unshift(accum)
  accum = accum.gcd(a)
end

p lefts.zip(rights).map { |a, b| a.gcd(b) }.max