n = gets.to_i
an = gets.split(' ').map{|a|a.to_i}

def gcd(a, b)
  gcd(b, a) if b > a
  return b if (r = a % b).zero?
  gcd(b, r)
end

if an.size == 2
  p an.max
  exit
end

if an.size == 3
  p [gcd(an[0], an[1]), gcd(an[0], an[2]), gcd(an[1], an[2])].max
  exit
end
l = Array.new(n+2, 0)
r = Array.new(n+2, 0)

1.upto(n) do | i | 
  l[i]= gcd(l[i-1], an[i])
end
n.upto(1) do | i | 
  r[i]= gcd(r[i+1], an[i])
end

max = 0 
(1..n).each do | i | 
  a = gcd(l[i-1], r[i+1])
  max = a if a > max 
end
p max