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

ans = 1
a.sort!

if n==2
  puts a.max
  exit
end

def find(n, a, ignore)
  b = Marshal.load(Marshal.dump(a))
  b.delete_at(ignore)
  current = b[0]
  (n-2).times do |i|
    # p [current, b[i+1]]
    current = current.gcd(b[i+1])
  end

  # p ["find", b, ignore, current]
  current
end

while true
  break_p = false
  current = a[0]

  (n-1).times do |i|
    result = current.gcd(a[i+1])
    if result == 1
      if i == 0
        current = [find(n, a, i), find(n, a, i+1)].max
      else
        current = find(n, a, i+1)
      end
      break_p = true
      break
    else
      current = result
    end
  end

  if current > 1
    # p ["kake", current]
    ans *= current
    a.map!{|e| e = e/current}
  end

  if break_p
    break
  end
end

puts ans
