require 'prime'

$n = gets.to_i
arr = gets[0..-2].split.map &:to_i

def calc(arr)
  result = []
  $n.times do |i|
    if i == 0
      result << arr[i]
      next
    end

    result << result[i-1].gcd(arr[i])
  end
  result
end
larr = calc(arr)
rarr = calc(arr.reverse).reverse

max = 0
$n.times do |i|
  if i == 0
    max = rarr[1]
    next
  end

  if i == $n-1
    max = [max, larr[-2]].max
    next
  end

  v = larr[i-1].gcd rarr[i+1]
  max = [max, v].max
end
puts max
