N = gets.to_i
A_n = gets.split.map(&:to_i)

ans = 0
N.times do |i|
  x = A_n[i-1]
  A_n.each.with_index do |a, idx|
    next if i == idx
    x = x.gcd(a)
    break if x == 1
  end
  ans = [ans, x].max
end
p ans