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

n = gets.chomp!.to_i
a_n = gets.chomp!.split(" ").map!(&:to_i).sort
a_n_copy = a_n.dup

gcd = a_n.gcd
nokori = a_n_copy.map {|x| x / gcd }

if nokori.size == 2
  puts a_n.max
else 
  x =  nokori.permutation(n-1).map do |xs|
    xs.gcd
  end
  puts gcd * x.max
end
