N = gets.to_i
A = gets.split.map(&:to_i).sort!

lgcd = [A[0]]
1.upto(N-1) do |i|
  lgcd[i] = lgcd[i-1].gcd(A[i])
end

rgcd = []
rgcd[N-1] = A[-1]
(N-2).downto(0) do |i|
  rgcd[i] = rgcd[i+1].gcd(A[i])
end

ans = 0
0.upto(N-1) do |i|
  gcd = if i == 0
    rgcd[1]
  elsif i == N-1
    lgcd[N-2]
  else
    rgcd[i+1].gcd(lgcd[i-1])
  end

  ans = gcd if ans < gcd
end

puts ans