#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;
int MOD = 998244353;
int N =    40000;
int arr[40001];
int gcd(int a,int b){
    if(a < b){
        int c = a;
        a = b;
        b = c;
    }
    if(a%b == 0) return b;
    else return gcd(b,a%b);
}
int a[10001];
signed main(){
    int n;cin >> n;
    vector<int> an;
    for(int i = n;i >= 0;i--)cin >> a[i];
    for(int i = 0; i < N; i++) arr[i] = 1;
    for(int i = 2; i < sqrt(N); i++){
        if(arr[i]){
            for(int j = 0; i * (j + 2) < N; j++){
                arr[i *(j + 2)] = 0;
            }
        }
    }

    arr[0] = 0;
    arr[1] = 0;
    int k = abs(a[n]);
    
    rep(i,n){
        if(a[i] != 0)k = gcd(k,abs(a[i]));
    }


    for(int i = 2;i <= 40000;i++){
        if(k%i == 0){
            // cout << i << endl;
            an.pb(i);
            arr[i] = 0;
        }
        while(k%i == 0){
            k/=i;
        }
        if(k == 1)break;
    }
    if(k != 1)an.pb(k);
    //rep(i,1000)cout<< i << "  " << arr[i] << endl;
    for(int i = 2;i <= 10000;i++){
        if(arr[i] == 0)continue;
        //cerr << a[0] << " " << abs(a[0])%i << endl;
        if(a[0] != 0 && abs(a[0])%i != 0)continue;
        int che = 1;
        int x = 100001;
        int t = 1;
        int c = 0;
        for(int j = 0;j <= n;j++){
            c += a[j]*t;
            //cerr << a[j] << t << "=>" << c;
            c += 11000000000000*i;
            c %= i;
            //cerr << c << endl << endl;
            t *= x;
            t %= i;
        }
        if(c != 0)continue;

        x = 100002;
        t = 1;
        c = 0;
        for(int j = 0;j <= n;j++){
            c += a[j]*t;
            c += 11000000000000*i;
            c %= i;
            t *= x;
            t %= i;
        }
        if(c != 0)continue;

        x = 100007;
        t = 1;
        c = 0;
        for(int j = 0;j <= n;j++){
            c += a[j]*t;
            c += 11000000000000*i;
            c %= i;
            t *= x;
            t %= i;
        }
        if(c != 0)continue;

        x = 100009;
        t = 1;
        c = 0;
        for(int j = 0;j <= n;j++){
            c += a[j]*t;
            c += 11000000000000*i;
            c %= i;
            t *= x;
            t %= i;
        }
        if(c != 0)continue;
        x = 100037;
        t = 1;
        c = 0;
        for(int j = 0;j <= n;j++){
            c += a[j]*t;
            c += 11000000000000*i;
            c %= i;
            t *= x;
            t %= i;
        }
        if(c != 0)continue;

        x = 100039;
        t = 1;
        c = 0;
        for(int j = 0;j <= n;j++){
            c += a[j]*t;
            c += 11000000000000*i;
            c %= i;
            t *= x;
            t %= i;
        }
        if(c != 0)continue;

        x = 100061;
        t = 1;
        c = 0;
        for(int j = 0;j <= n;j++){
            c += a[j]*t;
            c += 11000000000000*i;
            c %= i;
            t *= x;
            t %= i;
        }
        if(c != 0)continue;

        x = 100067;
        t = 1;
        c = 0;
        for(int j = 0;j <= n;j++){
            c += a[j]*t;
            c += 11000000000000*i;
            c %= i;
            t *= x;
            t %= i;
        }
        if(c != 0)continue;

        x = 100069;
        t = 1;
        c = 0;
        for(int j = 0;j <= n;j++){
            c += a[j]*t;
            c += 11000000000000*i;
            c %= i;
            t *= x;
            t %= i;
        }
        if(c != 0)continue;

        x = 100079;
        t = 1;
        c = 0;
        for(int j = 0;j <= n;j++){
            c += a[j]*t;
            c += 11000000000000*i;
            c %= i;
            t *= x;
            t %= i;
        }
        if(c != 0)continue;

        x = 100091;
        t = 1;
        c = 0;
        for(int j = 0;j <= n;j++){
            c += a[j]*t;
            c += 11000000000000*i;
            c %= i;
            t *= x;
            t %= i;
        }
        if(c != 0)continue;

        if(che == 1)an.pb(i);
    }
    SORT(an);
    rep(i,an.size()){
        cout << an[i] << endl;
    }





    
    
    
    return 0; 
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://cf17-final-open.contest.atcoder.jp/tasks/cf17_final_a
// rm -r -f test;oj dl http://s8pc-6.contest.atcoder.jp/tasks/s8pc_6_a

Measured memory_bytes: 768