require 'pp'
require 'prime'

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

m = Math.sqrt(a_n.max)
ans = 1
is_change = false
Prime.each(m).reverse_each do |prime|
    while true
        cnt = a_n.count {|a| a % prime == 0 }
        if cnt == n
            ans *= prime
            a_n.map! {|a| a / prime }
        elsif cnt == n - 1 && is_change == false
            is_change = true
            ans *= prime
            i = a_n.find_index {|a| a % prime != 0 }
            a_n.delete_at(i)
            a_n.map! {|a| a / prime }
        else
            break
        end
    end
end

puts ans
