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 N = io.read("n")
local A = {} for i=1,N do A[i] = io.read("n") end

local L, R = {}, {}
L[1] = A[1]
for i=2, N do
    L[i] = gcd(L[i-1], A[i])
end
R[N] = A[N]
for i=N-1, 1,-1 do
    R[i] = gcd(R[i+1], A[i])
end

local maxval = 0
maxval = math.max(maxval, R[2])
for i=2, N-1 do
    local g = gcd(L[i-1], R[i+1])
    maxval = math.max(maxval, g)
end
maxval = math.max(maxval, L[N-1])

print(maxval)