require 'pp'
require 'prime'

N = readline.to_i
A = readline.chomp.split.map(&:to_i)

count = Hash.new(0)

p0 = Hash[ A[0].prime_division ]
p1 = Hash[ A[1].prime_division ]
p0.each do |k,v|
  v.times do |e|
    count[ [k,e+1] ] += 1
  end
end
#pp count
p1.each do |k,v|
  v.times do |e|
    count[ [k,e+1] ] += 1
  end
end
#pp count

(2..(N-1)).each do |i|
  a = A[i]
  count.keys.each do |p,e|
    d = p**e
    if a % d != 0
      k = [p,e]
      count[k] -= 1
      count.delete(k) if count[k] == 0
    end
  end
end
#pp count

ans = Hash.new(0)
count.each do |k,v|
  ans[ k[0] ] = k[1] if ans[k[0]] < k[1]
end
#pp ans
puts ans.inject(1) {|m,(k,v)| m *= k**v }


