n = gets.to_i
a = gets.split.map(&:to_i)

exgcd = ->(x, y){x * y == 0 ? x + y : x.gcd(y)}

l = Array.new(n+1, 0)
n.times {|i| l[i+1] = exgcd.(l[i], a[i])}

r = Array.new(n+1, 0)
n.downto(1) {|i| r[i-1] = exgcd.(r[i], a[i-1])}

ans = 0
n.times do |i|
    x = exgcd.(l[i], r[i+1])
    ans = x if ans < x
end

p ans