require 'prime'

N = gets.to_i
A = gets.split.map(&:to_i)

class Array
  def gcd
    self.inject do |a, b|
      a.gcd(b)
    end
  end
end

gcd = A.gcd

ans =
case A.count(gcd)
when 0
  b = A.map {|a| a / gcd }
  h = b.map do |i|
    i.prime_division.transpose.first
  end.inject(Hash.new(0)) do |memo, item|
    item.each do |i|
      memo[i] += 1
    end
    memo
  end
  del = h.select {|k, v| v == N - 1 }.map do |p, _|
    [p, b.select {|i| i % p != 0 }.first]
  end.group_by(&:last).map {|k, arr| [k, arr.map(&:first).inject(:*)] }.max_by(&:last).first
  A.delete(del * gcd)
  A.gcd
when 1
  A.delete(gcd)
  A.gcd
else
  gcd
end

puts ans
