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

ans = 1
def gcda(ar)
  num = ar.first
  ar.each{|e| num = num.gcd(e)}
  num
end

def find(ar, plus=nil)
  num = 0
  ar.size.times do |i|
    new_a = ar.slice(0,i) + ar.slice(i+1,10**6)
    # p [i, new_a, gcda(new_a)]
    num = [num, gcda(new_a)].max
  end

  return plus ? num.gcd(plus) : num
end

if n <= 100
  puts find(a)
  exit
end

(n/100+1).times do |i|
  sliced = a.slice(i*100,i*100 + 100)
  left = a.slice(0, i*100) || []
  right = a.slice(i*100 + 100, 10**6) || []
  p [left, right]
  remain = left + right
  found = find(sliced, gcda(remain))
  ans = [ans,found].max
end

puts ans
