local function gcd(a,b)
    if b == 0 then
        return a
    else
        return gcd(b, a % b)
    end
end

local function gcdmany(tbl)
    local ans = tbl[1]
    for i=2,#tbl do
        ans = gcd(ans, tbl[i])
    end
    return ans
end

local function lcm(a, b)
    return a // gcd(a, b) * b
end

local function lcmmany(tbl)
    local ans = tbl[1]
    for i=2, #tbl do
        ans = lcm(ans, tbl[i])
    end
    return ans
end

-----
local function gcdmany_notx(tbl, x)
    local ans
    if x ~= 1 then
        ans = tbl[1]
        for i=2,#tbl do
            if i ~= x then
                ans = gcd(ans, tbl[i])
            end
        end
    else
        -- x == 1
        ans = tbl[2]
        for i=3,#tbl do
            ans = gcd(ans, tbl[i])
        end
    end
    return ans
end


local N = io.read("n")
local A = {} for i=1,N do A[i] = io.read("n") end

local maxval = 0
for i=1, N do
    local g = gcdmany_notx(A, i)
    maxval = math.max(maxval, g)
end
print(maxval)

