#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

class Xorshift
{
private:
    uint32_t x, y, z, w;
public:
    Xorshift(uint32_t seed=88675123, int32_t loop=50){
        x = 123456789;
        y = 362436069;
        z = 521288629;
        w = seed;
        while(--loop >= 0){
            (*this)();
        }
    }
    uint32_t operator()(){
        uint32_t t=(x^(x<<11));
        x=y; y=z; z=w;
        return w=(w^(w>>19))^(t^(t>>8));
    }
    uint32_t operator()(uint32_t size){
        return (*this)() % size;
    }
    uint64_t get64(){
        uint64_t a = (*this)();
        uint64_t b = (*this)();
        return (a << 32) | b;
    }
    uint64_t get64(uint64_t size){
        return get64() % size;
    }
    template <class T>
    void shuffle(vector<T>& v){
        uint32_t n = v.size();
        for(uint32_t i=0; i<n-1; ++i){
            uint32_t j = (*this)(n-i) + i;
            swap(v[i], v[j]);
        }
    }
};
Xorshift xorshift;

void findPrime(int N, vector<bool>& isPrime)
{
    isPrime.assign(N+1, true);
    isPrime[0] = isPrime[1] = false;
    for(int i=2; i*i<=N; i++){
        if(isPrime[i]){
            for(int j=i; i*j<=N; j++){
                isPrime[i*j] = false;
            }
        }
    }
}

void findPrime(int N, vector<int>& prime)
{
    vector<bool> isPrime;
    findPrime(N, isPrime);

    prime.clear();
    for(int i=0; i<=N; ++i){
        if(isPrime[i])
            prime.push_back(i);
    }
}

void integerFactorization(long long n, vector<pair<long long, int> >& factor)
{
    factor.clear();
    long long a = 2;
    while(a * a <= n){
        int b = 0;
        while(n % a == 0){
            ++ b;
            n /= a;
        }
        if(b > 0)
            factor.push_back(make_pair(a, b));
        ++ a;
    }
    if(n > 1)
        factor.push_back(make_pair(n, 1));
}

long long gcd(long long a, long long b){
    while(b != 0){
        long long tmp = a % b;
        a = b;
        b = tmp;
    }
    return a;
}

int T = 100;

bool solve(vector<int>& a, int mod)
{
    for(int t=0; t<=T; ++t){
        int n = a.size();
        long long x = xorshift();
        long long y = 0;
        for(int i=0; i<n; ++i){
            y *= x;
            y += a[i];
            y %= mod;
            y += mod;
            y %= mod;
        }
        if(y != 0)
            return false;
    }
    return true;
}

int main()
{
    int n;
    cin >> n;
    ++ n;
    vector<int> a(n);
    int g = 0;
    for(int i=0; i<n; ++i){
        cin >> a[i];
        g = (int)gcd(g, abs(a[i]));
    }
    for(int i=0; i<n; ++i)
        a[i] /= g;

    vector<int> prime;
    findPrime(n, prime);
    set<int> s;
    for(int x : prime){
        if(solve(a, x))
            s.insert(x);
    }

    vector<pair<long long, int> > factor;
    integerFactorization(g, factor);
    for(const auto& p : factor)
        s.insert((int)p.first);

    for(int x : s)
        cout << x << endl;

    return 0;
}


Measured memory_bytes: 256