N = gets.to_i
As = gets.split.map(&:to_i)

def gcd_skip_i(i)
    ans = As[0]
    if (i === 0) then
        ans = As[1]
    end
    N.times{|x|
        if (x != i) then
            ans = ans.gcd(As[x])
            if (ans === 1) then
                break;
            end
        end
    }
    return ans
end

ans2 = 0
N.times{|x|
    ans2 = [ans2, gcd_skip_i(x)].max
}

puts ans2
