def eratosthenes(n)
    l=[1]*n;r=[]
    (2..n).each{|i|
        if l[i-1]!=0
            r+=[i];j=2
            while i*j<=n
                l[i*j-1]=0;j+=1
            end
        end
    }
    return r
end
Ps=eratosthenes(40000)
def divisor(n)
    Ps.each{|q|
        if q*q>n then return -1 end
        if n%q==0 then return q end
    }
end
def prime_division(n)
    d={}
    d.default=0
    while n>1
        q=divisor(n)
        if q==-1 then d[n]+=1;break
        else d[q]+=1;n/=q end
    end
    return d
end


require 'prime'
N=gets.to_i
A=(N+1).times.map{gets.to_i}
G=(prime_division(A.inject(A[0],:gcd)).map{|k,_|k}+eratosthenes(N)).sort.uniq
def div(q)
    if A[-1]%q!=0 then return A[-1]%q end
    if A.inject(0){|m,a|m+a%q}==0 then return 0 end
    l=A[q,N+1-q].map{|a|a%q}
    r=A[0,q].map{|a|a%q}
    #p l,r
    ind=0
    (0..(N-q)).each{|i|
        a=r[ind];ind+=1
        r[-1] = (r[-1]+a)%q
        r << l[i]
        #p r
    }
    r[-q,q].inject :+
end
G.each{|q|
    #p q
    if div(q)==0 then p q end
}