n = gets.chomp.to_i

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

if n < 3
    puts line[0] < line[1] ? line[1] : line[0]
    exit
end

# line = line.slice(0, 3)

arr = Array.new(line.max + 1, 0)
candidacy = []
line.each do |v|
    arr[v] += 1
    candidacy.push(v) if arr[v] == n - 1
    for i in 2..(v / 2)
        if v % i == 0
            arr[i] += 1
            if arr[i] == n - 1
                candidacy.push(i)
            end
        end
    end
    # p "#{v}"
    # p arr
    # p candidacy
end

p candidacy.max
