class Segtree
  attr_reader :dat
  def initialize(n)
    @n = 1
    while @n < n
      @n *= 2
    end
    @dat = {}
  
    (@n * 2 - 1).times do |i|
      # @dat[i] = Float::INFINITY
      @dat[i] = 0
    end
  end

  # k番目(0-indexed)の値をaに変更
  # def update(k, a)
  #   k += @n - 1
  #   @dat[k] = a

  #   while k > 0
  #     k = (k - 1) / 2
  #     @dat[k] = [@dat[k * 2 + 1], @dat[k * 2 + 2]].min
  #   end
  # end
  def update(k, a)
    k += @n - 1
    @dat[k] = a

    while k > 0
      k = (k - 1) / 2
      @dat[k] = @dat[k * 2 + 1].gcd(@dat[k * 2 + 2])
    end
  end

  # [a, b)の最小値を求める
  def query(a, b, k = 0,l = 0, r = @n)
    return Float::INFINITY if r <= a || b <= l
    return @dat[k] if a <= l && r <= b
    vl = query(a,b,k * 2 + 1, l, (l + r) / 2)
    vr = query(a,b,k * 2 + 2, (l + r) / 2, r)
    [vl, vr].min
  end
end

n = gets.to_i
as = gets.split.map(&:to_i)
if n.odd?
  s = Segtree.new(n+1)
else
  s = Segtree.new(n)
end

as.each.with_index do |a,i|
  s.update(i,a)
end

ans = 1
as.each.with_index do |a,i|
  s.update(i,0)
  ans = [ans, s.dat[0]].max
  s.update(i,a)
end

puts ans
