require "set"

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

yakusu_arr = []
n.times do |t|
  yakusu_arr << Set.new
end

(1..Math.sqrt(arr.max).to_i).each do |t|
  arr.each_with_index do |a, i|
    if a >= t && a % t == 0 then
      yakusu_arr[i] << t
      yakusu_arr[i] << a / t
    end
  end
end

puts yakusu_arr.map(&:to_a).flatten.group_by(&:itself).select{|k, v| v.size >= n - 1}.map{|k, v| k}.max

