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

class Array
  def lcm
    self.inject{|a,b| a.lcm(b)}
  end

  def gcd
    self.inject{|a,b| a.gcd(b)}
  end
end

max = 1
(0..n-1).each do |i|
  tmp = 1
  l = []
  r = []
  l = a.slice(0..i-1) if i > 0
  r = a.slice(i+1..n-1) if i< n-1
  ar = l + r
  tmp = ar.gcd 
  max = tmp if ar.gcd > max
end
puts max