def gcd(a,b)
  while b > 0
    a, b = b,a%b
  end
  return a
end

n = gets.to_i + 2
a = gets.split.map(&:to_i)
a.unshift(0)
a.push(0)


l = []
r = []
array = []
max = 0
gcdl = 0
gcdr = 0

(0..n-1).each do |x|
  gcdl = gcd(a[x],gcdl)
  gcdr = gcd(a[n-x-1],gcdr)
  l.push(gcdl)
  r.push(gcdr)
end

p l
p r

gcd = 0

(0..n-3).each do |y|
  gcd = gcd(l[y],r[n-y-3])
  max = gcd if gcd > max
end

puts max