n=gets.to_i
a = gets.split(' ').map(&:to_i)
#h=gets.split(' ').map(&:to_i)
right = Array.new()
left = Array.new()
for i in 1..n-1
  left[i] = a[i-1].gcd(a[i])
end

(n-2).downto(0) do |i|
  right[i] = a[i+1].gcd(a[i])
end

left[0] = a[0]
right[n-1] = a[n-1]

max=0
for  i in 1..n-2
  smp = left[i-1].gcd(right[i+1])
  if smp> max
    max = smp
  end
end

puts [left[n-1],right[0],max].max