n = gets.to_i
arr = gets.split.map(&:to_i)
fr = [0]*n
en = [0]*n

def gcd(a, b)
  b>0 ? gcd(b, a%b) : a
end

fr[0] = arr[0]

(1...n).each do |i|
  fr[i] = gcd(fr[i-1], arr[i])
end

en[n-1] = arr[n-1]

(n-2).downto(0) do |i|
  en[i] = gcd(en[i+1], arr[i])
end

res = [en[1], fr[n-2]].max

(1..n-2).each do |i|
  res = [res, gcd(fr[i-1], en[i+1])].max
end

p res
