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

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

gcd = 0
max = 0
n.times do |x|
  (n-x-1).times do |y|
    gcd = gcd(a[x],a[y+x+1])
    max = gcd if gcd > max;
  end
end

puts max

