N = gets.to_i
A = gets.split(' ').map(&:to_i).sort.reverse
max = 1

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

  if count >= 2
    max = 1
    break
  end

  gcd = *A
  gcd.delete_at(i)
  max = gcd.inject(:gcd) if max < gcd.inject(:gcd)
end

puts max