#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){return b%a ? gcd(b%a,a) : a;}
int main(){
    int N;
    cin>>N;
    int a,b,c;
    cin>>a>>b;
    if(N==3) cin>>c;
    int tmp=gcd(a,b);
    if(N==3) tmp=gcd(tmp,c);
    for(int i=1;i<=tmp;i++){
        if(tmp%i==0) cout<<i<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define rg register
#define rep(i,a,b) for (rg int i=a;i<=b;i++)
#define per(i,a,b) for (rg int i=b;i>=a;i--)
#define pb push_back
#define lowbit(x) (x&(-x))
#define mk make_pair
#define VI vector<int>
#define pii pair<int,int>
#define pLL pair<long long,long long>
#define fi first
#define se second
#define il inline
#define ll long long
#define db double
#define ld long double
#define inf 0x3f3f3f3f
#define getc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<15,stdin),p1==p2)?EOF:*p1++)
char buf[1<<15],*p1 = buf,*p2 = buf;
inline ll read(){
    #define num ch-'0'
    char ch;bool flag=0;ll res;
    while(!isdigit(ch=getc()))
    (ch=='-')&&(flag=true);
    for(res=num;isdigit(ch=getc());res=res*10ll+num);
    (flag)&&(res=-res);
    #undef num
    return res;
}
inline void write(ll x){
	if (x < 0) x = ~x + 1ll, putchar('-');
	if (x > 9) write(x / 10ll);
	putchar(x % 10ll + '0');
}
#define mid ((l + r)>>1)
#define ls (x<<1)
#define rs ((x<<1)|1)
#undef mid
#undef ls
#undef rs
ll gcd(ll a,ll b) {return b == 0?a:gcd(b,a%b);}
void solve()
{
	ll a = read(),b = read();
	ll c = gcd(a,b);
	int tot = 1;
	for(ll i =2 ;i*i<=c;i++)
	{
		if(c%i==0)
		{
			while(c%i==0) c/=i;
			tot++;
		}
	}
	if(c>1) tot++;
	cout<<tot<<endl;
}
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("data.txt","r",stdin);
	#endif
//	int T = read();
//	while(T--)
	solve();
}