def gcd(a, b)
  return b if (r = a % b).zero?
  gcd(b, r)
end
n = gets.chomp.to_i
as = gets.split.map(&:to_i)
if as.size == 2
  ans = as.max
else
  one_ans = gcd(as[0],as[1])
  two_ans = gcd(as[0],as[2])
  three_ans = gcd(as[1],as[2])
  one_count = 0
  two_count = 0
  three_count = 0
  as.each do |num|
    one_count += 1   if num % one_ans == 0
    two_count += 1   if num % two_ans == 0
    three_count += 1 if num % three_ans == 0
  end
  one_ans_next   = one_count   == (n - 1) ? one_ans : 1
  two_ans_next   = two_count   == (n - 1) ? two_ans : 1
  three_ans_next = three_count == (n - 1) ? three_ans : 1
  ans = [one_ans_next, two_ans_next, three_ans_next].max
end
puts ans