class Array
  def lcm
    inject(:lcm)
  end
  def gcd
    inject(:gcd)
  end
end

n = gets.to_i
arr = gets.split(' ').map(&:to_i)
max = 0
n.times do |i|
  max = [max, (arr[0, i] + arr[i + 1, n]).gcd].max
end
puts max