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

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

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

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

ar = []
(0..(n-1)).each do |i|
  arTemp = []
  arTemp << arA
  arTemp.flatten!.delete_at(i)
  ar << findGcd(arTemp)
end

puts ar.max
