n = gets.to_i
arA = gets.split(" ").map(&:to_i)

if n == 2 then
  puts arA.max
  exit
end

def findGcd(nums)
  if nums.length == 1 then
    return 0
  elsif nums.length == 2 then
    return nums[0].gcd(nums[1])
  end

  return findGcd(nums.drop(1)).gcd(nums.first)
end

arA.unshift(0).push(0)
arARev = arA.reverse
ans = 1

(1..n).each do |i|
  l = arARev.drop(n + 2 - i)
  r = arA.drop(1 + i)
  gcdi = findGcd(l).gcd(findGcd(r))
  ans = gcdi if ans < gcdi
end

puts ans
