n = gets.to_i
nums = gets.split(' ').map(&:to_i)

map = {}
while n > 0
  x = nums[n - 1]
  y = nums[n - 2]
  gcd = x.gcd(y)

  if map.has_key?(gcd)
    map[gcd] += [n - 1]
  else
    map[gcd] = [n - 1]
  end
  n -= 1
end

keys = map.keys

if keys.count == 1
  puts keys[0]
else
  min = keys.min
  if map[min].count < 2 or (map[min].count == 2 && (map[min][0] - map[min][1]).abs == 1)
    keys.delete(min)
  end
  puts keys.inject(:gcd)
end