require 'prime'

N = gets.to_i
A = gets.split(' ').map(&:to_i).sort.reverse
GCD = []
count = 0
max = 1

N.times do |i|
  if Prime.prime?(A[i])
    count += 1
  else
    GCD.push(A[i])
  end
end

N.times do |i|
  if count < 1
    gcd = GCD.reject{ |e| e == GCD[i] }
  else
    gcd = GCD
  end

  max = gcd.inject(:gcd) if max < gcd.inject(:gcd)
end

puts count > 1 ? 1 : max
