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

gcdL = ary[0]
gcdR = ary[-1]
aryGcdL = []
aryGcdR = []

for i in 0 .. n - 1
  gcdL = gcdL.gcd(ary[i])
  aryGcdL << gcdL
  gcdR = gcdR.gcd(ary[n - i - 1])
  aryGcdR << gcdR
end

aryGcdL.unshift(0).push(0)
aryGcdR.unshift(0).push(0).reverse!

tmp = []

for i in 0 .. n - 1
  tmp << aryGcdL[i].gcd(aryGcdR[i + 2])
end

#p aryGcdL, aryGcdR, tmp

puts tmp.max
