def divisors(n)
  res = []
  lim = Math.sqrt(n)
  i = 1
  while i <= lim
    if n % i == 0
      res.push(i)
      res.push(n / i)
    end
    i += 1
  end
  res.uniq.sort
end

def max_accept(divs, xs)
  divs.reverse_each do |d|
    if xs.count { |x| x % d != 0 } <= 1
      return d
    end
  end
end

def solve(a)
  [
    max_accept(divisors(a[0]), a[1..-1]),
    max_accept(divisors(a[1]), [*a[0], *a[2..-1]])
  ].max
end

def main
  n = gets.to_i
  a = gets.split.map(&:to_i)

  p solve(a)
end

main
