#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#define ALL(u) (u).begin(),(u).end()

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

typedef pair<int, int> PII;

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;

const LL inf = (1e18) + 100;

LL mul(LL a, LL b)
{
	if (a > b)
		swap(a, b);
	if (!a)
		return 0;
	if (a == 1)
		return b;

	LL tmp = mul(a / 2, b);
	if (tmp >= inf)
		return tmp;

	return tmp + tmp + (a % 2, b);
}

LL zajeb(LL ile, int n)
{
	if (ile >= inf)
		return ile;

	LL tmp = 1, s = 0;
	FORQ(i, 1, n)
	{
		s += tmp;

		tmp *= 4;
		if (tmp >= inf)
			return tmp;

		if (s >= inf)
			return s;
	}

	// zajeb wszystkie kwadraty
	return mul(ile, s);
}

int siekaj(int n, LL k)
{
	// ile kwadratow, 2^x
	int x = 0;
	while (n && k > 0)
	{
		// sieknij
		LL ile = 1;
		FORQ(i, 1, x)
		{
			ile *= 2;
			if (ile >= inf)
				break;
		}

		// trzeba sieknac brzeg - kazdy kwadrat 1 raz
		k -= ile;

		// zwieksza sie liczba kwadratow na brzegu i zmniejsza ich rozmiar
		x++;
		n--;

		if (k <= 0)
			break;

		// dobij wszystkie kwadraty spoza
		k -= zajeb(4 * (ile - 1) + 1, n);
	}

	if (k > 0)
		return -1;

	return n;
}

int main()
{
	int t;
	scanf("%d", &t);

	REP(c, t)
	{
		int n;
		LL k;

		scanf("%d%lld", &n, &k);

		int res = siekaj(n, k);
		if (res == -1)
			printf("NO\n");
		else
			printf("YES %d\n", res);
	}

	return 0;
}


#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#define ALL(u) (u).begin(),(u).end()

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

typedef pair<int, int> PII;

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;

const LL inf = (1e18) + 100;

LL mul(LL a, LL b)
{
	if (a > b)
		swap(a, b);
	if (!a)
		return 0;
	if (a == 1)
		return b;

	LL tmp = mul(a / 2, b);
	if (tmp >= inf)
		return tmp;

	return tmp + tmp + (a % 2, b);
}

LL zajeb(LL ile, int n)
{
	if (ile >= inf)
		return ile;

	LL tmp = 1, s = 0;
	FORQ(i, 1, n)
	{
		if (tmp >= inf)
			return tmp;

		s += tmp;

		if (s >= inf)
			return s;

		tmp *= 4;
	}

	// zajeb wszystkie kwadraty
	return mul(ile, s);
}

int siekaj(int n, LL k)
{
	// ile kwadratow, 2^x
	int x = 0;
	while (n && k > 0)
	{
		// sieknij
		LL ile = 1;
		FORQ(i, 1, x)
		{
			ile *= 2;
			if (ile >= inf)
				break;
		}

		// trzeba sieknac brzeg - kazdy kwadrat 1 raz
		k -= 2 * (ile - 1) + 1;

		// zwieksza sie liczba kwadratow na brzegu i zmniejsza ich rozmiar
		x++;
		n--;

		if (k <= 0)
			break;

		// dobij wszystkie kwadraty spoza
		k -= zajeb(4 * (ile - 1) + 1, n);
	}

	if (k > 0)
		return -1;

	return n;
}

int main()
{
	int t;
	scanf("%d", &t);

	REP(c, t)
	{
		int n;
		LL k;

		scanf("%d%lld", &n, &k);

		int res = siekaj(n, k);
		if (res == -1)
			printf("NO\n");
		else
			printf("YES %d\n", res);
	}

	return 0;
}


#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#define ALL(u) (u).begin(),(u).end()

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

typedef pair<int, int> PII;

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;

const LL inf = (1e18) + 100;

LL mul(LL a, LL b)
{
	if (a > b)
		swap(a, b);
	if (!a)
		return 0;
	if (a == 1)
		return b;

	LL tmp = mul(a / 2, b);
	if (tmp >= inf)
		return tmp;

	return tmp + tmp + (a % 2, b);
}

LL zajeb(LL ile, int n)
{
	if (ile >= inf)
		return ile;

	LL tmp = 1, s = 0;
	FORQ(i, 1, n)
	{
		s += tmp;

		tmp *= 4;
		if (tmp >= inf)
			return tmp;

		if (s >= inf)
			return s;
	}

	// zajeb wszystkie kwadraty
	return mul(ile, s);
}

int siekaj(int n, LL k)
{
	// ile kwadratow, 2^x
	int x = 0;
	while (n && k > 0)
	{
		// sieknij
		LL ile = 1;
		FORQ(i, 1, x)
		{
			ile *= 2;
			if (ile >= inf)
				break;
		}

		// trzeba sieknac brzeg - kazdy kwadrat 1 raz
		k -= 2 * (ile - 1) + 1;

		// zwieksza sie liczba kwadratow na brzegu i zmniejsza ich rozmiar
		x++;
		n--;

		if (k <= 0)
			break;

		// dobij wszystkie kwadraty spoza
		k -= zajeb(4 * (ile - 1) + 1, n);
	}

	if (k > 0)
		return -1;

	return n;
}

int main()
{
	int t;
	scanf("%d", &t);

	REP(c, t)
	{
		int n;
		LL k;

		scanf("%d%lld", &n, &k);

		int res = siekaj(n, k);
		if (res == -1)
			printf("NO\n");
		else
			printf("YES %d\n", res);
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main(){
	int T;
	cin >> T;
	while(T--){
		long long n, k;
		cin >> n >> k;
		if(n==2&&k==3){
			cout << "NO\n";
			continue;
		}
		if(n==2&k==4){
			cout << "YES 0\n";
			continue;
		}
		long long curn = n, curk = k, l = 1, res = -1;
		for(; curn*curk; ){
//			cout << curn << " " << curk << " " << l << endl;
			if(curk>=l*l){
				curk-=l*l;
			}else{
				curk=0;
				break;
			}
			curn--;
			l*=2ll;
		}
		if(curk) cout << "NO\n";
		else cout << "YES " << curn << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main(){
	int T;
	cin >> T;
	while(T--){
		long long n, k;
		cin >> n >> k;
		bool ok = false;
		for(long long i = 1; i <= n; i++){
			if(pow(4, i)-1 >= 3*k){
				cout << "YES " << i-1 << endl;
				ok = true;
				break;
			}
		}
		if(!ok) cout << "NO\n";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main(){
	int T;
	cin >> T;
	while(T--){
		long long n, k;
		cin >> n >> k;
		if(n==2&&k==3){
			cout << "NO\n";
			continue;
		}
		if(n==2&k==4){
			cout << "YES 0\n";
			continue;
		}
		long long curn = n, curk = k, l = 1, res = -1;
		for(; curn*curk; ){
//			cout << curn << " " << curk << " " << l << endl;
			if(curk>=l*l){
				curk-=l*l;
			}else{
				if(curn >= 60){
					curk=0;
					break;
				}
//				long long c = (2ll*l-1)*(pow(4ll, n)-1)/3;
				long long v = (l-1)*(l-1)*(pow(4ll, curn)-1)/3;
				if(v < curk){
					curn--;
				}
				curk=0;
				break;
			}
			curn--;
			l*=2ll;
		}
		if(curk) cout << "NO\n";
		else cout << "YES " << curn << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main(){
	int T;
	cin >> T;
	while(T--){
		long long n, k;
		cin >> n >> k;
		if(n==2&&k==3){
			cout << "NO\n";
			continue;
		}
		if(n==2&&k==2){
			cout << "YES 1\n";
			continue;
		}
		long long curn = n, curk = k, l = 1;
		for(; curn*curk; curn--, l*=2ll){
			cout << curn << " " << curk << " " << l << endl;
			if(curk>=l*l){
				curk-=l*l;
			}else{
				if((l-1)*(l-1) < k && k < 2*l-1){
					break;
				}else{
					if(curk <= (l-1)*(l-1)){
						curn++;
					}
					curk = 0;
				}
			}
		}
		if(curk) cout << "NO\n";
		else cout << "YES " << curn << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main(){
	int T;
	cin >> T;
	while(T--){
		long long n, k;
		cin >> n >> k;
		if((n==2&&k==3) || (n<=30 && k>(pow(4ll, n)-1)/3)){
			cout << "NO\n";
			continue;
		}
		long long curn = n-1, curk = k-1, l = 1;
		for(; curn*curk && curk>=4ll*l-1; curk -= 4ll*l-1, curn--, l*=2ll){}
		cout << "YES " << curn << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main(){
	int T;
	cin >> T;
	while(T--){
		long long n, k;
		cin >> n >> k;
		if(n==2&&k==3){
			cout << "NO\n";
			continue;
		}
		if(n==2&&k==2){
			cout << "YES 1\n";
			continue;
		}
		long long curn = n, curk = k, l = 1;
		for(; curn*curk; curn--, l*=2ll){
//			cout << curn << " " << curk << " " << l << endl;
			if(curk>=l*l){
				curk-=l*l;
			}else{
				if((l-1)*(l-1) < k && k < 2*l-1){
					break;
				}else{
					if(curk <= (l-1)*(l-1)){
						curn++;
					}
					curk = 0;
				}
			}
		}
		if(curk) cout << "NO\n";
		else cout << "YES " << curn << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main(){
	int T;
	cin >> T;
	while(T--){
		long long n, k;
		cin >> n >> k;
		if(n==2&&k==3){
			cout << "NO\n";
			continue;
		}
		if(n==2&k==4){
			cout << "YES 0\n";
			continue;
		}
		long long curn = n, curk = k, l = 1, res = -1;
		for(; curn*curk; ){
//			cout << curn << " " << curk << " " << l << endl;
			if(curk>=l*l){
				curk-=l*l;
			}else{
				if(curn >= 60){
					curk=0;
					break;
				}
//				long long c = (2ll*l-1)*(pow(4ll, n)-1)/3;
				long long v = (l-1)*(l-1)*(pow(4ll, curn)-1)/3;
				if(v < k){
					curn--;
				}
				curk=0;
				break;
			}
			curn--;
			l*=2ll;
		}
		if(curk) cout << "NO\n";
		else cout << "YES " << curn << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main(){
	int T;
	cin >> T;
	while(T--){
		long long n, k;
		cin >> n >> k;
		long long curn = n, curk = k, l = 1;
		for(; curn*curk; curn--, l*=2ll){
//			cout << curn << " " << curk << " " << l << endl;
			if(curk>=l*l){
				curk-=l*l;
			}else{
				if((l-1)*(l-1) < k && k < 2*l-1){
					break;
				}else{
					if(curk <= (l-1)*(l-1)){
						curn++;
					}
					curk = 0;
				}
			}
		}
		if(curk) cout << "NO\n";
		else cout << "YES " << curn << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main(){
	int T;
	cin >> T;
	while(T--){
		long long n, k;
		cin >> n >> k;
		if(n==2&&k==3){
			cout << "NO\n";
			continue;
		}
		long long curn = n, curk = k, l = 1, res = -1;
		for(; curn*curk; ){
//			cout << curn << " " << curk << " " << l << endl;
			if(curk>=l*l){
				curk-=l*l;
			}else{
				curk = 0;
				break;
			}
			curn--;
			l*=2ll;
		}
		if(curk) cout << "NO\n";
		else cout << "YES " << curn << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main(){
	int T;
	cin >> T;
	while(T--){
		long long n, k;
		cin >> n >> k;
		if(n==2&&k==3){
			cout << "NO\n";
			continue;
		}
		if(n==2&k==3){
			cout << "YES 0\n";
			continue;
		}
		long long curn = n, curk = k, l = 1, res = -1;
		for(; curn*curk; ){
//			cout << curn << " " << curk << " " << l << endl;
			if(curk>=l*l){
				curk-=l*l;
			}else{
				k=0;
				break;
			}
			curn--;
			l*=2ll;
		}
		if(curk) cout << "NO\n";
		else cout << "YES " << ((res>0)?res:curn) << endl;
	}
	return 0;
}


  #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define pb push_back
#define f first
#define s second
#define mp make_pair
#define SZ(x) ((int)(x.size()))
#define FOI(i, a, n) for(int i = int(a); i <= int(n); i++)
#define FOD(i, a, n) for(int i = int(a); i >= int(n); i--)
#define IN(x, y) ((y).find(x) != (y).end())
#define ALL(t) t.begin(),t.end()
#define MSET(tabl,i) memset(tabl, i, sizeof(tabl))
#define PSET(x,y) fixed<<setprecision(y)<<lf(x)
#define DBG(c) cout << #c << " = " << c << endl;
#define Rtime1 ((double)clock()/(double)CLOCKS_PER_SEC)
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double lf;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
typedef vector < int > vi;
typedef vector<vi> vvi;
typedef complex<double> base;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << std::endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const int N = 3e5 + 5;
const int lgN = 1e6+5;
const int te = 3e8+1;
const ll MOD = 998244353;
const ll MOD2 = 1299709;
const ll MOD3 = 1e9 + 9;
const lf pi = 3.141592653589793238462643383;
const ll IMAX = 4e18 + 5;
const double PI = 3.141592653589793;

template<class T>
using max_pq = priority_queue<T>;
template<class T>
using min_pq = priority_queue<T,vector<T>,greater<T>>;
template<class T>
using OST = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ll x,y;
template<class T> T gcd(T a,T b){ if(a==0) {x=0,y=1; return b;}T gc=gcd(b%a,a);T temp;temp=x;x=y-(b/a)*temp;y=temp;return gc;}

//(a^x)%m
ll po(ll a, ll x,ll m){ if(x==0){return 1;}ll ans=1;ll k=1;  while(k<=x) {if(x&k){ans=((ans*a)%m);} k<<=1; a*=a; a%=m; }return ans; }

ll p4[32];

int main()
{
    sync
    p4[0] = 1;
    FOI(i,1,31)
        p4[i] = p4[i-1]*4;
    int t;
    cin>>t;
    while(t--)
    {
        ll n,k;
        cin>>n>>k;
        if(n > 31)
        {
            cout<<"YES "<<(n-1)<<endl;
            continue;
        }

        ll val = p4[n-1];
        val/=3;
        val++;
        int flag =0;
        FOD(i, n-1, 0)
        {
            if(val >= k)
            {
                cout<<"YES "<<i<<endl;
                flag = 1;
                break;
            }
            else
            {
                val+=3;
                val += (p4[i-1]/3)*4;
            }
        }

        if(!flag)
        cout<<"NO"<<endl;
    }
}


  #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define pb push_back
#define f first
#define s second
#define mp make_pair
#define SZ(x) ((int)(x.size()))
#define FOI(i, a, n) for(int i = int(a); i <= int(n); i++)
#define FOD(i, a, n) for(int i = int(a); i >= int(n); i--)
#define IN(x, y) ((y).find(x) != (y).end())
#define ALL(t) t.begin(),t.end()
#define MSET(tabl,i) memset(tabl, i, sizeof(tabl))
#define PSET(x,y) fixed<<setprecision(y)<<lf(x)
#define DBG(c) cout << #c << " = " << c << endl;
#define Rtime1 ((double)clock()/(double)CLOCKS_PER_SEC)
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double lf;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
typedef vector < int > vi;
typedef vector<vi> vvi;
typedef complex<double> base;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << std::endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const int N = 3e5 + 5;
const int lgN = 1e6+5;
const int te = 3e8+1;
const ll MOD = 998244353;
const ll MOD2 = 1299709;
const ll MOD3 = 1e9 + 9;
const lf pi = 3.141592653589793238462643383;
const ll IMAX = 4e18 + 5;
const double PI = 3.141592653589793;

template<class T>
using max_pq = priority_queue<T>;
template<class T>
using min_pq = priority_queue<T,vector<T>,greater<T>>;
template<class T>
using OST = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ll x,y;
template<class T> T gcd(T a,T b){ if(a==0) {x=0,y=1; return b;}T gc=gcd(b%a,a);T temp;temp=x;x=y-(b/a)*temp;y=temp;return gc;}

//(a^x)%m
ll po(ll a, ll x,ll m){ if(x==0){return 1;}ll ans=1;ll k=1;  while(k<=x) {if(x&k){ans=((ans*a)%m);} k<<=1; a*=a; a%=m; }return ans; }

ll p4[32];

int main()
{
    sync
    p4[0] = 1;
    FOI(i,1,31)
        p4[i] = p4[i-1]*4;
    int t;
    cin>>t;
    while(t--)
    {
        ll n,k;
        cin>>n>>k;
                int flag =0;

        if(n > 31)
        {
            cout<<"YES "<<(n-1)<<endl;
            flag = 1;
        }

        ll val = p4[n-1] - 1;
        val/=3;
        val++;
        ll t1 = 1, t2 = 0;
        if(k > ((p4[n]-1)/3))
        {
            cout<<"NO"<<endl;
            flag = 1;
        }
        FOD(i, n-1, 0)
        {
            if(val >= k)
            {
                cout<<"YES "<<i<<endl;
                flag = 1;
                break;
            }
            else
            {
                val+= t1*3 + t2;
                ll sp = t1 * 5 + t2 * 3;
                t2 += t1;
                t1 *= 2;
                val += ((p4[i-1]-1)/3)*sp;
            }
        }

        if(!flag)
        cout<<"NO"<<endl;
    }
}


  #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define pb push_back
#define f first
#define s second
#define mp make_pair
#define SZ(x) ((int)(x.size()))
#define FOI(i, a, n) for(int i = int(a); i <= int(n); i++)
#define FOD(i, a, n) for(int i = int(a); i >= int(n); i--)
#define IN(x, y) ((y).find(x) != (y).end())
#define ALL(t) t.begin(),t.end()
#define MSET(tabl,i) memset(tabl, i, sizeof(tabl))
#define PSET(x,y) fixed<<setprecision(y)<<lf(x)
#define DBG(c) cout << #c << " = " << c << endl;
#define Rtime1 ((double)clock()/(double)CLOCKS_PER_SEC)
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double lf;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
typedef vector < int > vi;
typedef vector<vi> vvi;
typedef complex<double> base;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << std::endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const int N = 3e5 + 5;
const int lgN = 1e6+5;
const int te = 3e8+1;
const ll MOD = 998244353;
const ll MOD2 = 1299709;
const ll MOD3 = 1e9 + 9;
const lf pi = 3.141592653589793238462643383;
const ll IMAX = 4e18 + 5;
const double PI = 3.141592653589793;

template<class T>
using max_pq = priority_queue<T>;
template<class T>
using min_pq = priority_queue<T,vector<T>,greater<T>>;
template<class T>
using OST = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ll x,y;
template<class T> T gcd(T a,T b){ if(a==0) {x=0,y=1; return b;}T gc=gcd(b%a,a);T temp;temp=x;x=y-(b/a)*temp;y=temp;return gc;}

//(a^x)%m
ll po(ll a, ll x,ll m){ if(x==0){return 1;}ll ans=1;ll k=1;  while(k<=x) {if(x&k){ans=((ans*a)%m);} k<<=1; a*=a; a%=m; }return ans; }

ll p4[35];

int main()
{
    sync
    p4[0] = 1;
    FOI(i,1,31)
        p4[i] = p4[i-1]*4;
    int t;
    cin>>t;
    while(t--)
    {
        ll n,k;
        cin>>n>>k;
        int flag =0;

        if(n > 31)
        {
            cout<<"YES "<<(n-1)<<endl;
            flag = 1;
        }

        ll val = p4[n-1] - 1;
        val/=3;
        val++;
        ll t1 = 1, t2 = 0;
        ll up = p4[n] - 1;
        up /= 3;
        if(flag == 0)
        {
            if( k > up)
            {
                cout<<"NO"<<endl;
                flag = 1;
            }
        }
        val = 1;
        ll b[34], c[34];
        b[n-1] = 1;
        c[n-1] = (p4[n-1]-1)/3;
        c[n] = 0;
        b[n] = 0;
        if(flag == 0)
        FOD(i, n-1, 1)
        {
            {
                val += t1*3 + t2;
                ll sp = t1*5 + t2*3;
                t2 += t1;
                t1 *= 2;
                c[i-1] = ((p4[i-1]-1)/3)*sp;
                b[i-1] = val;
            }
        }
        FOD(i, n-1 ,0)
        {
            c[i] = c[i] + c[i+1];
            b[i] = b[i] + b[i+1];
        }
        if(!flag)
        {
            FOI(i, 0, n-1)
            {
                if( k <= c[i] + b[i] && k>=b[i])
                {
                    cout<<"YES "<<i<<endl;
                    flag = 1;
                    break;
                }
            }
        }
        if(!flag)
        cout<<"YES 0"<<endl;
    }
}


  #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define pb push_back
#define f first
#define s second
#define mp make_pair
#define SZ(x) ((int)(x.size()))
#define FOI(i, a, n) for(int i = int(a); i <= int(n); i++)
#define FOD(i, a, n) for(int i = int(a); i >= int(n); i--)
#define IN(x, y) ((y).find(x) != (y).end())
#define ALL(t) t.begin(),t.end()
#define MSET(tabl,i) memset(tabl, i, sizeof(tabl))
#define PSET(x,y) fixed<<setprecision(y)<<lf(x)
#define DBG(c) cout << #c << " = " << c << endl;
#define Rtime1 ((double)clock()/(double)CLOCKS_PER_SEC)
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double lf;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
typedef vector < int > vi;
typedef vector<vi> vvi;
typedef complex<double> base;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << std::endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const int N = 3e5 + 5;
const int lgN = 1e6+5;
const int te = 3e8+1;
const ll MOD = 998244353;
const ll MOD2 = 1299709;
const ll MOD3 = 1e9 + 9;
const lf pi = 3.141592653589793238462643383;
const ll IMAX = 4e18 + 5;
const double PI = 3.141592653589793;

template<class T>
using max_pq = priority_queue<T>;
template<class T>
using min_pq = priority_queue<T,vector<T>,greater<T>>;
template<class T>
using OST = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ll x,y;
template<class T> T gcd(T a,T b){ if(a==0) {x=0,y=1; return b;}T gc=gcd(b%a,a);T temp;temp=x;x=y-(b/a)*temp;y=temp;return gc;}

//(a^x)%m
ll po(ll a, ll x,ll m){ if(x==0){return 1;}ll ans=1;ll k=1;  while(k<=x) {if(x&k){ans=((ans*a)%m);} k<<=1; a*=a; a%=m; }return ans; }

ll p4[35];

int main()
{
    sync
    p4[0] = 1;
    FOI(i,1,31)
        p4[i] = p4[i-1]*4;
    int t;
    cin>>t;
    while(t--)
    {
        ll n,k;
        cin>>n>>k;
        int flag =0;

        if(n > 31)
        {
            cout<<"YES "<<(n-1)<<endl;
            flag = 1;
        }

        ll val = p4[n-1] - 1;
        val/=3;
        val++;
        ll t1 = 1, t2 = 0;

        if(flag == 0)
        {
                    ll up = p4[n] - 1;
        up /= 3;
            if( k > up)
            {
                cout<<"NO"<<endl;
                flag = 1;
            }
        }
        val = 1;
        ll b[34], c[34];
        b[n-1] = 1;
        c[n] = b[n] = 0;
        c[n-1] = (p4[n-1]-1)/3;
        if(flag == 0)
        FOD(i, n-1, 1)
        {
            {
                val += t1*3 + t2;
                ll sp = t1*5 + t2*3;
                t2 += t1;
                t1 *= 2;
                c[i-1] = ((p4[i-1]-1)/3)*sp;
                b[i-1] = val;
            }
        }
        FOD(i, n-1 ,0)
        {
            c[i] = c[i] + c[i+1];
            b[i] = b[i] + b[i+1];
        }
        if(!flag)
        {
            FOI(i, 0, n-1)
            {
                if( k <= c[i] + b[i] && k>=b[i])
                {
                    cout<<"YES "<<i<<endl;
                    flag = 1;
                    break;
                }
            }
        }
        if(!flag)
        cout<<"YES 0"<<endl;
    }
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long

int main()
{
	ll n;
	cin>>n;

	ll x = 0;

	for(ll c1=0;c1<n;c1++)
	{
		ll tmp;
		cin>>tmp;

		x = __gcd(x,tmp);
	}

	ll ans=0, c1;

	for(c1=1;c1*c1<x;c1++)
	{
		if(x%c1==0)
		{
			ans++;

		}
	}

	ans*=2;

	if(c1*c1==x)
		ans++;

	cout<<ans<<endl;
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long

int main()
{
	int n;
	cin>>n;

	int x = 0;

	for(int c1=0;c1<n;c1++)
	{
		int tmp;
		cin>>tmp;

		x = __gcd(x,tmp);
	}

	int ans=0, c1;

	for(c1=1;c1*c1<x;c1++)
	{
		if(x%c1==0)
		{
			ans++;

		}
	}

	ans*=2;

	if(c1*c1==x)
		ans++;

	cout<<ans<<endl;
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define frw(i, a, b) for(int i = a; i < b; i++)
#define fi first
#define se second
#define pb push_back
#define in insert
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(a) int(a.size())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define vpll vector<pll>

ll fac[1000001]={0};
vll v;

void prime(ll a)
{
	for(ll c1=1;c1<=a/2;c1++)
	{
		if(a%c1==0)
		{
			fac[c1]++;
			v.pb(c1);
		}
	}

	v.pb(a);
}

int  main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	//cout.tie(NULL);

	int n;
	cin>>n;

	ll arr[n]={0},mn=10000000000;

	frw(c1, 0, n)
	{
		cin>>arr[c1];
		if(arr[c1]<mn)
			mn=arr[c1];
	}

	prime(mn);

	frw(c1,0,n)
	{
		if(arr[c1]!=mn)
		frw(c2,0,v.size())
		{
			if(arr[c1]%v[c2]!=0)
			{
				v.erase(v.begin()+c2);
				c2--;
			}
		}
	}

	cout<<v.size()<<endl;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define frw(i, a, b) for(int i = a; i < b; i++)
#define fi first
#define se second
#define pb push_back
#define in insert
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(a) int(a.size())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define vpll vector<pll>

vll v;

void prime(ll a)
{
	for(ll c1=1;c1<=a/2;c1++)
	{
		if(a%c1==0)
		{
			v.pb(c1);
		}
	}

	v.pb(a);
}

int  main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	//cout.tie(NULL);

	int n;
	cin>>n;

	ll arr[n]={0},mn=10000000000;

	frw(c1, 0, n)
	{
		cin>>arr[c1];
		if(arr[c1]<mn)
			mn=arr[c1];
	}

	prime(mn);

	frw(c1,0,n)
	{
		if(arr[c1]!=mn)
		frw(c2,0,v.size())
		{
			if(arr[c1]%v[c2]!=0)
			{
				v.erase(v.begin()+c2);
				c2--;
			}
		}
	}

	cout<<v.size()<<endl;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define frw(i, a, b) for(int i = a; i < b; i++)
#define fi first
#define se second
#define pb push_back
#define in insert
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(a) int(a.size())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define vpll vector<pll>

vll v;
int fac[1000001]={0};

void prime(ll a)
{
	for(ll c1=1;c1<=sqrt(a);c1++)
	{
		if(a%c1==0)
		{
			v.pb(c1);
			fac[c1]++;
		}
	}

	int len = v.size();
	frw(c1, 0, len)
	{
		ll tmp = a/v[c1];

		if(tmp>1000000 || fac[tmp]==0)
			v.pb(tmp);

	}
}

int  main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int n;
	cin>>n;

	ll arr[n]={0},mn=10000000000;

	frw(c1, 0, n)
	{
		cin>>arr[c1];
		if(arr[c1]<mn)
			mn=arr[c1];
	}

	prime(mn);

	frw(c1,0,n)
	{
		if(arr[c1]!=mn)
		frw(c2,0,v.size())
		{
			if(arr[c1]%v[c2]!=0)
			{
				v.erase(v.begin()+c2);
				c2--;
			}
		}
	}

	cout<<v.size()<<endl;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define frw(i, a, b) for(int i = a; i < b; i++)
#define fi first
#define se second
#define pb push_back
#define in insert
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(a) int(a.size())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define vpll vector<pll>

vll v;
int fac[1000001]={0};

void prime(ll a)
{
	fac[1]++;

	for(ll c1=2;c1<=sqrt(a);c1++)
	{
		while(a%c1==0)
		{
			fac[c1]++;
			a/=c1;
			//cout<<c1<<endl;
		}
	}
}

int  main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	//cout.tie(NULL);

	int n;
	cin>>n;

	ll arr[n]={0},mn=10000000000,x;

	frw(c1, 0, n)
	{
		cin>>arr[c1];

		if(c1!=0)
			x = __gcd(x,arr[c1]);
		else
			x=arr[c1];
	}

	prime(x);

	ll mult = 1;

	frw(c1, 1, 1000001)
	{
		if(fac[c1]!=0)
		{
			mult *= (fac[c1]+1);
		}
	}

	cout<<mult<<endl;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define frw(i, a, b) for(int i = a; i < b; i++)
#define fi first
#define se second
#define pb push_back
#define in insert
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(a) int(a.size())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define vpll vector<pll>

int  main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	//cout.tie(NULL);

	ll n;
	cin >> n;

	ll tmp, x=0;

	frw(c1, 0, n)
	{
		cin>>tmp;

		x = __gcd(tmp, x);
	}

	ll cnt=0;

	for(ll c1=1;(c1*c1)<=x;c1++)
	{
		if(x%c1==0)
		{
			cnt++;
		}
		if(c1!=(x/c1))
		{
			cnt++;
		}
	}
	cout<<cnt;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long

int main()
{
	int n;
	cin>>n;

	int x = 0;

	for(int c1=0;c1<n;c1++)
	{
		int tmp;
		cin>>tmp;

		x = __gcd(x,tmp);
	}

	int ans;

	if(x>1)
		ans=2;
	else
		ans=1;

	for(int c1=2;c1<=sqrt(x);c1++)
	{
		if(x%c1==0)
		{
			ans++;
			//cout<<c1<<' '<<x<<endl;

		}
		if(x!=(x/c1))
		{
			ans++;
			//cout<<c1<<' '<<x/c1<<endl;
		}
	}

	cout<<ans<<endl;
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define frw(i, a, b) for(int i = a; i < b; i++)
#define fi first
#define se second
#define pb push_back
#define in insert
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(a) int(a.size())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define vpll vector<pll>

vll v;
int fac[1000001]={0};

void prime(ll a)
{
	ll lm = sqrt(a);
	for(ll c1=2;c1<=lm;c1++)
	{
		while(a%c1==0)
		{
			fac[c1]++;
			a/=c1;
			//cout<<c1<<endl;
		}

	}

	if(a>2)
		fac[a]++;
}

int  main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	//cout.tie(NULL);

	int n;
	cin>>n;

	ll arr[n]={0},mn=10000000000,x;

	frw(c1, 0, n)
	{
		cin>>arr[c1];

		if(c1!=0)
			x = __gcd(x,arr[c1]);
		else
			x=arr[c1];
	}

	//prime(x);

	ll cnt=0;

	frw(c1, 1, sqrt(x)+1)
	{
		if(x%c1==0)
			cnt++;
		if((x/c1)!=c1)
			cnt++;
	}

	cout<<cnt<<endl;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define frw(i, a, b) for(int i = a; i < b; i++)
#define fi first
#define se second
#define pb push_back
#define in insert
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(a) int(a.size())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define vpll vector<pll>

int  main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	//cout.tie(NULL);

	ll n;
	cin >> n;

	ll arr[n], x=0;

	frw(c1, 0, n)
	{
		cin>>arr[c1];

		x = __gcd(arr[c1], x);
	}

	ll cnt=0;

	for(long long c1=1;(c1*c1)<=x;c1++)
	{
		if(x%c1==0)
		{
			cnt++;
		}
		if(c1!=(x/c1))
		{
			cnt++;
		}
	}
	cout<<cnt;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define frw(i, a, b) for(int i = a; i < b; i++)
#define fi first
#define se second
#define pb push_back
#define in insert
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(a) int(a.size())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define vpll vector<pll>

vll v;
int fac[1000001]={0};

void prime(ll a)
{
	ll lm = sqrt(a);
	for(ll c1=2;c1<=lm;c1++)
	{
		while(a%c1==0)
		{
			fac[c1]++;
			a/=c1;
			//cout<<c1<<endl;
		}

	}

	if(a>2)
		fac[a]++;
}

int  main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	//cout.tie(NULL);

	int n;
	cin>>n;

	ll arr[n]={0},mn=10000000000,x;

	frw(c1, 0, n)
	{
		cin>>arr[c1];

		if(c1!=0)
			x = __gcd(x,arr[c1]);
		else
			x=arr[c1];
	}

	prime(x);

	ll mult = 1;

	frw(c1, 1, 1000001)
	{
		if(fac[c1]!=0)
		{
			mult *= (fac[c1]+1);
		}
	}

	cout<<mult<<endl;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define frw(i, a, b) for(int i = a; i < b; i++)
#define fi first
#define se second
#define pb push_back
#define in insert
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(a) int(a.size())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define vpll vector<pll>

int  main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	//cout.tie(NULL);

	ll n;
	cin >> n;

	ll tmp, x=0;

	frw(c1, 0, n)
	{
		cin>>tmp];

		x = __gcd(tmp, x);
	}

	ll cnt=0;

	for(ll c1=1;(c1*c1)<=x;c1++)
	{
		if(x%c1==0)
		{
			cnt++;
		}
		if(c1!=(x/c1))
		{
			cnt++;
		}
	}
	cout<<cnt;

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ll long long

int main()
{
	int n;
	cin>>n;

	int x = 0;

	for(int c1=0;c1<n;c1++)
	{
		int tmp;
		cin>>tmp;

		x = __gcd(x,tmp);
	}

	int ans=0;

	for(int c1=1;c1<=sqrt(x);c1++)
	{
		if(x%c1==0)
			ans++;
		if(x!=(x/c1))
			ans++;
	}

	cout<<ans<<endl;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{

int n,i,j,count=0;
cin>> n;
vector<int> a;

for(i=0;i<n;i++)
{
  long q;
  cin>>q;
      a.push_back(q);

}

sort(a.begin(),a.end());

long gcd1=__gcd(a[0],a[1]);

for(i=1;i<=gcd1;i++)
{

    for( j=0;j<a.size();j++)
    {
        if(a[j]%i==0)
        {
            if(j==(a.size()-1))
            {
                // cout<<"h";
                count++;
            }

            // cout<<i<<" ";

        }
        else{

            break;
        }
    }
}

// cout<<gcd1;

      cout<<count;

       return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{

long long n,i,j,count=0;
cin>> n;
vector<long long> a,d;

for(i=0;i<n;i++)
{
  long long q;
  cin>>q;
      a.push_back(q);

}

sort(a.begin(),a.end());

// for(i=0;i<d.size();i++)
// {
//   cout<<d[i]<<" ";
// }
// cout<<endl;

long long gcd1=a[0];

for(i=0;i<a.size();i++)
{
    gcd1=__gcd(a[i],gcd1);
}

for(i=1;i<=sqrt(gcd1);i++)
{
  if(gcd1%i==0)
  {
    d.push_back(i);
    if(gcd1/i!=i)
    {
      d.push_back(gcd1/i);
    }
  }
}

for(i=0;i<d.size();i++)
{

  for(j=0;j<a.size();j++)
  {
   if(a[j]%d[i]==0)
   {
     if(j==a.size()-1)
     {
       count++;
     }

   }
   else
{
  break;
}

  }

}

// cout<<gcd1;

      cout<<count;

       return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{

int n,i,count=1;
cin>>n;
int a[n];
for(i=0;i<n;i++)
{
       cin>>a[i];

}
sort(a,a+n);

 int max=sqrt(a[n-1]);
 for(i=2;i<=max;i++)
 {
        for(int j=0;j<n;j++)
        {
              if(a[j]%i==0)
              {
                      if(j==n-1)
                      {
                             count++;
                      }
              }
              else{
                      break;
              }
        }
 }

       cout<<count;

       return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{

int n,i,j,count=0;
cin>>n;
int a[n];
for(i=0;i<n;i++)
{
       cin>>a[i];

}

sort(a,a+n);

int gcd1=__gcd(a[1],a[0]);

for(i=1;i<=gcd1;i++)
{

    for( j=0;j<n;j++)
    {
        if(a[j]%i==0)
        {
            if(j==(n-1))
            {
                // cout<<"h";
                count++;
            }

            // cout<<i<<" ";

        }
        else{

            break;
        }
    }
}

// cout<<gcd1;

      cout<<count;

       return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{

long long n,i,j,count=0;
cin>> n;
vector<long long> a,d;

for(i=0;i<n;i++)
{
  long q;
  cin>>q;
      a.push_back(q);

}

sort(a.begin(),a.end());
long long  min=a[0];

for(i=1;i<sqrt(min);i++)
{
  if(min%i==0)
  {
    d.push_back(i);
    d.push_back(min/i);
  }
}
// for(i=0;i<d.size();i++)
// {
//   cout<<d[i]<<" ";
// }
// cout<<endl;

long gcd1=__gcd(a[0],a[1]);

for(i=0;i<d.size();i++)
{
  if(d[i]<=gcd1)
  {
  for(j=0;j<a.size();j++)
  {
   if(a[j]%d[i]==0)
   {
     if(j==a.size()-1)
     {
       count++;
     }

   }
   else
{
  break;
}

  }
}
}

// cout<<gcd1;

      cout<<count;

       return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{

long long n,i,j,count=0;
cin>> n;
vector<long long> a,d;

for(i=0;i<n;i++)
{
  long long q;
  cin>>q;
      a.push_back(q);

}

sort(a.begin(),a.end());
long long  min=a[0];

for(i=1;i<=sqrt(min);i++)
{
  if(min%i==0)
  {
    d.push_back(i);
    if(min/i!=i)
    {
    d.push_back(min/i);
  }
  }
}

// for(i=0;i<d.size();i++)
// {
//   cout<<d[i]<<" ";
// }
// cout<<endl;

long gcd1=__gcd(a[0],a[1]);

for(i=0;i<d.size();i++)
{
  if(d[i]<=gcd1)
  {
  for(j=0;j<a.size();j++)
  {
   if(a[j]%d[i]==0)
   {
     if(j==a.size()-1)
     {
       count++;
     }

   }
   else
{
  break;
}

  }
}
}

// cout<<gcd1;

      cout<<count;

       return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{

int n,i,count=1;
cin>>n;
int a[n];
for(i=0;i<n;i++)
{
       cin>>a[i];

}
sort(a,a+n);

 for(i=2;i<=a[n-1];i++)
 {
        for(int j=0;j<n;j++)
        {
              if(a[j]%i==0)
              {
                      if(j==n-1)
                      {
                             count++;
                      }
              }
              else{
                      break;
              }
        }
 }

       cout<<count;

       return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{

long long n,i,j,count=0;
cin>> n;
vector<long long> a,d;

for(i=0;i<n;i++)
{
  long q;
  cin>>q;
      a.push_back(q);

}

sort(a.begin(),a.end());
long long  min=a[0];

for(i=1;i<=sqrt(min);i++)
{
  if(min%i==0)
  {
    d.push_back(i);
    if(min/i!=i)
    {
    d.push_back(min/i);
  }
  }
}

// for(i=0;i<d.size();i++)
// {
//   cout<<d[i]<<" ";
// }
// cout<<endl;

long gcd1=__gcd(a[0],a[1]);

for(i=0;i<d.size();i++)
{
  if(d[i]<=gcd1)
  {
  for(j=0;j<a.size();j++)
  {
   if(a[j]%d[i]==0)
   {
     if(j==a.size()-1)
     {
       count++;
     }

   }
   else
{
  break;
}

  }
}
}

// cout<<gcd1;

      cout<<count;

       return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{

long long n,i,j,count=0;
cin>> n;
vector<long long> a,d;

for(i=0;i<n;i++)
{
  long long q;
  cin>>q;
      a.push_back(q);

}

sort(a.begin(),a.end());
long long  min=a[0];

for(i=1;i<=sqrt(min);i++)
{
  if(min%i==0)
  {
    d.push_back(i);
    if(min/i!=i)
    {
    d.push_back(min/i);
  }
  }
}

// for(i=0;i<d.size();i++)
// {
//   cout<<d[i]<<" ";
// }
// cout<<endl;

long long gcd1=__gcd(a[0],a[1]);

for(i=0;i<d.size();i++)
{
  if(d[i]<=gcd1)
  {
  for(j=0;j<a.size();j++)
  {
   if(a[j]%d[i]==0)
   {
     if(j==a.size()-1)
     {
       count++;
     }

   }
   else
{
  break;
}

  }
}
}

// cout<<gcd1;

      cout<<count;

       return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{

long long n,i,j,count=0;
cin>> n;
vector<long long> a,d;

for(i=0;i<n;i++)
{
  long long q;
  cin>>q;
      a.push_back(q);

}

sort(a.begin(),a.end());

long long gcd1=a[0];

for(i=0;i<a.size();i++)
{
    gcd1=__gcd(a[i],gcd1);
}

for(i=1;i<=sqrt(gcd1);i++)
{
  if(gcd1%i==0)
  {
    d.push_back(i);
    if(gcd1/i!=i)
    {
      d.push_back(gcd1/i);
    }
  }
}

// for(i=0;i<d.size();i++)
// {
//   cout<<d[i]<<" ";
// }
// cout<<endl;
//
//
//
//
// for(i=0;i<d.size();i++)
// {
//
//   for(j=0;j<a.size();j++)
//   {
//    if(a[j]%d[i]==0)
//    {
//      if(j==a.size()-1)
//      {
//        count++;
//      }
//
//    }
//    else
// {
//   break;
// }
//
//
//   }
//
// }

// cout<<gcd1;

      cout<<d.size();

       return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{

int n,i,j,count=0;
cin>>n;
int a[n];
for(i=0;i<n;i++)
{
       cin>>a[i];

}

sort(a,a+n);

int gcd1=__gcd(a[0],a[1]);

for(i=1;i<=gcd1;i++)
{

    for( j=0;j<n;j++)
    {
        if(a[j]%i==0)
        {
            if(j==(n-1))
            {
                // cout<<"h";
                count++;
            }

            // cout<<i<<" ";

        }
        else{

            break;
        }
    }
}

// cout<<gcd1;

      cout<<count;

       return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{

int n,i,count=0;
cin>>n;
int a[n];
for(i=0;i<n;i++)
{
       cin>>a[i];

}
sort(a,a+n);
int sqmax=floor(sqrt(a[n-1]));
vector<int> v;

 for(i=1;i<=sqmax;i++)
 {
     if(a[n-1]%i==0)
     {
         v.push_back(a[n-1]/i);
     }
 }

 sort(v.begin(),v.end());

//  for(i=0;i<v.size();i++)
//  {
//      cout<<v[i]<<" ";
//  }

 for(i=1;i<sqmax;i++)
 {
        for(int j=0;j<n;j++)
        {
              if(a[j]%i==0)
              {
                      if(j==n-1)
                      {
                             count++;
                      }
              }
              else{
                      break;
              }
        }

 }

 for(i=0;i<v.size();i++)
 {

        for(int j=0;j<n;j++)
        {
              if(a[j]%v[i]==0)
              {
                      if(j==n-1)
                      {
                             count++;
                      }
              }
              else{
                      break;
              }
        }
 }

      cout<<count;

       return 0;
}


#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
using namespace std;
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
int main(){
      ios_base::sync_with_stdio(false);cin.tie(NULL);

ll int n;
cin>>n;
ll int a[n];
long long gcd=0;
for(int i=0;i<n;i++){cin>>a[i];gcd=__gcd(a[i],gcd);}
ll c=0;
for(int i=1;i*i<=gcd;i++){
    if(gcd%i==0){
        if(gcd/i!=i)c+=2;
        else c++;
    }
}
cout<<c;

    return 0;
}


#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
using namespace std;
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
int main(){
ios_base::sync_with_stdio(false);  cin.tie(NULL);
ll int n;
cin>>n;
ll int a[n];
long long gc=0;
for(int i=0;i<n;i++){cin>>a[i];}gc=a[0];
for(int i=1;i<n;i++)gc=__gcd(gc,a[i]);
ll c=0;
for(int i=1;i*i<=gc;i++){
    if(gc%i==0){
        if(gc/i!=i)c+=2;
        else c++;
    }
}
cout<<c;
    return 0;
}


#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
using namespace std;
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
int main(){
ll int n;
cin>>n;
ll int a[n];
long long gc=0;
for(int i=0;i<n;i++){cin>>a[i];}
for(int i=0;i<n;i++)gc=__gcd(a[i],gc);
ll c=0;
for(int i=1;i*i<=gc;i++){
    if(gc%i==0){
        if(gc/i!=i)c+=2;
        else c++;
    }
}
cout<<c;
    return 0;
}


#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
using namespace std;
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
int main(){
ll int n;
cin>>n;
ll int a[n];
long long gc=0;
for(int i=0;i<n;i++){cin>>a[i];}gc=a[0];
for(int i=1;i<n;i++)gc=__gcd(a[i],gc);
ll c=0;
for(int i=1;i*i<=gc;i++){
    if(gc%i==0){
        if(gc/i!=i)c+=2;
        else c++;
    }
}
cout<<c;
    return 0;
}


#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
using namespace std;
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
int main(){
ll int n;
cin>>n;
ll int a[n];
long long gc=0;
for(int i=0;i<n;i++){cin>>a[i];gc=__gcd(a[i],gc);}
ll c=0;
for(int i=1;i*i<=gc;i++){
    if(gc%i==0){
        if(gc/i!=i)c+=2;
        else c++;
    }
}
cout<<c;
    return 0;
}


#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
using namespace std;
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
int main(){
ll int n;
cin>>n;
ll int a[n];
long long gcd=0;
for(int i=0;i<n;i++){cin>>a[i];gcd=__gcd(a[i],gcd);}
ll c=0;
for(int i=1;i*i<=gcd;i++){
    if(gcd%i==0){
        if(gcd/i!=i)c+=2;
        else c++;
    }
}
cout<<c;

    return 0;
}


#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
using namespace std;
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
int main(){
ios_base::sync_with_stdio(false);  cin.tie(NULL);
ll int n;
cin>>n;
ll int a[n];
long long gc=0;
for(int i=0;i<n;i++){cin>>a[i];}gc=a[0];
for(int i=1;i<n;i++)gc=__gcd(a[i],gc);
ll c=0;
for(int i=1;i*i<=gc;i++){
    if(gc%i==0){
        if(gc/i!=i)c+=2;
        else c++;
    }
}
cout<<c;
    return 0;
}


#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
using namespace std;
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
int main(){
ll int n;
cin>>n;
ll int a[n];
long long gc=0;
for(int i=0;i<n;i++){cin>>a[i];gc=__gcd(a[i],gc);}
ll c=0;
for(int i=1;i*i<=gc;i++){
    if(gc%i==0){
        if(gc/i!=i)c+=2;
        else c++;
    }
}
cout<<c;

    return 0;
}


#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
using namespace std;
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
ll int gcd(ll int a, ll int b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
int main(){
 int n;
cin>>n;
ll a;
long long gc=0;
for(int i=0;i<n;i++){cin>>a;gc=gcd(a,gc);}
ll cc=0;
for(ll int i=1;i*i<=gc;i++){
    if(gc%i==0){
        if(gc/i!=i)cc+=2;
        else cc++;
    }
}
cout<<cc;
    return 0;
}


#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
using namespace std;
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
int main(){
ll int n;
cin>>n;
ll int a[n];
long long gc=0;
for(int i=0;i<n;i++){cin>>a[i];}
for(int i=0;i<n;i++)gc=__gcd(a[i],gc);}
ll c=0;
for(int i=1;i*i<=gc;i++){
    if(gc%i==0){
        if(gc/i!=i)c+=2;
        else c++;
    }
}
cout<<c;
    return 0;
}


#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
using namespace std;
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
int main(){
ll int n;
cin>>n;
ll int a[n];
long long gcd=0;
for(int i=0;i<n;i++){cin>>a[i];gcd=__gcd(a[i],gcd);}
ll c=0;
for(int i=1;i*i<gcd;i++){
    if(gcd%i==0){
        if(gcd/i!=i)c+=2;
        else c++;
    }
}
cout<<c;

    return 0;
}


#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
using namespace std;
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
int main(){
ll int n;
cin>>n;
ll int a;
long long gc=0;
for(int i=0;i<n;i++){cin>>a;gc=__gcd(a,gc);}
ll c=0;
for(int i=1;i*i<=gc;i++){
    if(gc%i==0){
        if(gc/i!=i)c+=2;
        else c++;
    }
}
cout<<c;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<unsigned long long> v(n);
    unsigned long long i,j;
    unsigned long long min=ULONG_MAX;
    for(i=0;i<n;i++){
    cin>>v[i];
    if(v[i]<min)
    min=v[i];
    }
    int res=0;
    unsigned long long t;
    vector<unsigned long long int> v1;
    for(i=1;i*i<=min;i++){
        if(min%i==0){
            if(i!=(min/i)){
                v1.push_back(i);
                v1.push_back(min/i);
            }
            else
            v1.push_back(i);
        }
    }
    int n1=v1.size();
    for(i=0;i<n1;i++){
        for(j=0;j<n;j++){
        if((v[j]%v1[i])!=0)
        break;
        }
        if(j==n)
        res++;
    }
    cout<<res;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<unsigned long long> v(n);
    unsigned long long i,j;
    unsigned long long min=ULONG_MAX;
    for(i=0;i<n;i++){
    cin>>v[i];
    if(v[i]<min)
    min=v[i];
    }
    int res=0;
    unsigned long long t;
    vector<unsigned long long> v1;
    for(i=1;i*i<=min;i++){
        if(min%i==0){
            if(i!=(min/i)){
                v1.push_back(i);
                v1.push_back(min/i);
            }
            else
            v1.push_back(i);
        }
    }
    int n1=v1.size();
    for(i=0;i<n1;i++){
        bool f=true;
        for(j=0;j<n;j++){
        if(v[j]%v1[i]!=0){
        f=false;
        break;
        }
        }
        if(f==true)
        res++;
    }
    cout<<res;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<unsigned long long> v(n);
    int i,j;
    unsigned long long min=ULONG_MAX;
    for(i=0;i<n;i++){
    cin>>v[i];
    if(v[i]<min)
    min=v[i];
    }
    int res=0;
    for(i=1;i*i<=min;i++){
        bool f1=true,f2=true;
        for(j=0;j<n;j++){
            if((v[j]%i)!=0){
                f1=false;
                break;
            }
        }
        unsigned long long t=min/i;
        for(j=0;j<n;j++){
            if(v[j]%t!=0){
                f2=false;
                break;
            }
        }
        if(f1==true){
        res++;
        }
        if(f2==true && t!=i)
        res++;
    }
    cout<<res;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<unsigned long long> v(n);
    int i,j;
    unsigned long long min=ULONG_MAX;
    for(i=0;i<n;i++){
    cin>>v[i];
    if(v[i]<min)
    min=v[i];
    }
    int res=0;
    for(i=1;i*i<=min;i++){
        bool f1=true,f2=true;
        unsigned long long t=min/i;
        for(j=0;j<n;j++){
            if((v[j]%i)!=0){
                f1=false;
            }
            if(v[j]%t!=0)
            f2=false;
        }
        if(f1==true){
        res++;
        }
        if(f2==true && t!=i)
        res++;
    }
    cout<<res;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<unsigned long long> v(n);
    unsigned long long i,j;
    unsigned long long min=ULONG_MAX;
    for(i=0;i<n;i++){
    cin>>v[i];
    if(v[i]<min)
    min=v[i];
    }
    int res=0;
    unsigned long long t;
    vector<unsigned long long> v1;
    for(i=1;i*i<=min;i++){
        if(min%i==0){
            t=min/i;
            if(i!=t)
            v1.push_back(t);
            v1.push_back(i);
        }
    }
    int n1=v1.size();
    for(i=0;i<n1;i++){
        bool f=true;
        for(j=0;j<n;j++){
        if(v[j]%v1[i]!=0){
        f=false;
        break;
        }
        }
        if(f==true)
        res++;
    }
    cout<<res;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<unsigned long long> v(n);
    int i,j;
    unsigned long long min=ULONG_MAX;
    for(i=0;i<n;i++){
    cin>>v[i];
    if(v[i]<min)
    min=v[i];
    }
    int res=0;
    for(i=1;i*i<=min;i++){
        bool f=true;
        for(j=0;j<n;j++){
            if((v[j]%i)!=0){
                f=false;
                break;
            }
        }
        if(f==true){
        if(i!=(min/i))
        res+=2;
        else
        res+=1;
        }
    }
    cout<<res;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<unsigned long long> v(n);
    unsigned long long i,j;
    unsigned long long min=ULONG_MAX;
    for(i=0;i<n;i++){
    cin>>v[i];
    if(v[i]<min)
    min=v[i];
    }
    int res=0;
    vector<unsigned long long> v1;
    for(i=1;i*i<=min;i++){
        if(min%i==0){
            if(i!=(min/i)){
                v1.push_back(i);
                v1.push_back(min/i);
            }
            else
            v1.push_back(i);
        }
    }
    int n1=v1.size();
    for(i=0;i<n1;i++){
        for(j=0;j<n;j++){
        if((v[j]%v1[i])!=0)
        break;
        }
        if(j==n)
        res++;
    }
    cout<<res;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<unsigned long long> v(n);
    unsigned long long i,j;
    unsigned long long min=ULONG_MAX;
    for(i=0;i<n;i++){
    cin>>v[i];
    if(v[i]<min)
    min=v[i];
    }
    int res=0;
    unsigned long long t;
    vector<unsigned long long int> v1;
    for(i=1;i*i<=min;i++){
        if(min%i==0){
            if(i!=(min/i)){
                v1.push_back(i);
                v1.push_back(min/i);
            }
            else
            v1.push_back(i);
        }
    }
    int n1=v1.size();
    for(i=0;i<n1;i++){
        for(j=0;j<n;j++){
        if(v[j]%v1[i]!=0)
        break;
        }
        if(j==n)
        res++;
    }
    cout<<res;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<long long> v(n);
    long long i;
    long long g=0;
    for(i=0;i<n;i++){
        cin>>v[i];
        g=__gcd(g,v[i]);
    }
    int res=0;
    for(i=1;i*i<=g;i++){
        if(g%i==0){
            res++;
            if(i!=g/i)
            res++;
        }
    }
    cout<<res;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<unsigned long long> v(n);
    unsigned long long i,j;
    unsigned long long min=1000000000000;
    for(i=0;i<n;i++){
    cin>>v[i];
    if(v[i]<min)
    min=v[i];
    }
    int res=0;
    unsigned long long t;
    vector<unsigned long long> v1;
    for(i=1;i*i<=min;i++){
        if(min%i==0){
            t=min/i;
            if(i!=t)
            v1.push_back(t);
            v1.push_back(i);
        }
    }
    int n1=v1.size();
    for(i=0;i<n1;i++){
        bool f=true;
        for(j=0;j<n;j++){
        if(v[j]%v1[i]!=0){
        f=false;
        break;
        }
        }
        if(f==true)
        res++;
    }
    cout<<res;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<unsigned long long> v(n);
    int i,j;
    unsigned long long min=ULONG_MAX;
    for(i=0;i<n;i++){
    cin>>v[i];
    if(v[i]<min)
    min=v[i];
    }
    int res=0;
    unsigned long long t;
    for(i=1;i*i<=min;i++){
        t=min/i;
        bool f=true;
        for(j=0;j<n;j++){
            if(v[j]%t!=0){
                f=false;
                break;
            }
        }
        if(f==true)
        break;
    }
    for(i=1;i*i<=t;i++){
        if(t%i==0){
            if(i!=(t/i))
            res+=2;
            else
            res+=1;
        }
    }
    cout<<res;
    return 0;
}


   #include <algorithm>
    #include <bits/stdc++.h>
    #include <cctype>
    #include <cmath>
    #include <cstdio>
    #include <iomanip>
    #include <iostream>
    #include <list>

    #include <stack>
    #include <string>
    #include <vector>
    #include <bits/stdc++.h>
    #define INFINI (1000 * 1000 * 1000)

    using namespace std;
    //#define s(T) scanf("%d", &T)
    #define sl(T) scanf("%lld", &T)
    #define fill(a, val) memset(a, val, sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define all(x) x.begin(), x.end()
    #define DREP(x) sort(all(x)); x.erase(unique(all(x)), x.end())
    #define INDEX(a, val) (lower_bound(all(a), val) - a.begin())
    #define mod ll(1e9+7)
    typedef long long ll;

    bool compare_first(pair<int,pair<int,int> >a,pair<int,pair<int,int> >b)
    {
        return a.first<b.first;
    }

     bool compare_second(pair<int,pair<int , int> > a,pair<int,pair<int , int> > b)
    {
        return a.second.first<b.second.first;
    }

ll pow(ll n)
{
    ll ans=1;
    while(n--)
    {
        ans*=2;
        ans%=998244353;
    }
    return ans;

}
    int main() {
      ios::sync_with_stdio(false);

ll n;
cin>>n;
ll arr[n];
for(ll index=0;index<n;index++)
    cin>>arr[index];
    sort(arr,arr+n);
  bool diviseall=true;
  for(ll index=1;index<n;index++)
        if(arr[index]%arr[0])
  {
      diviseall=false;
      break;
  }
  if(!diviseall){cout<<1<<endl;return 0;}

  ll ans=0;
  for(ll index=1;index<=arr[0];index++)
  if(arr[0]%index==0)
    ans++;

  cout<<ans<<endl;

return 0;
    }


#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main()
{

ll n;
cin>>n;

ll arr[n];
for(ll index=0;index<n;index++)
cin>>arr[index];

ll gcd=arr[0];
for(ll index=1;index<n;index++)
gcd=__gcd(gcd,arr[index]);

ll ans=0;
ll last=(ll)sqrt(gcd)
for(ll index=1;index<last;index++)
if(gcd%index==0)
ans++;

if(last*last==gcd)
ans++;
cout<<ans<<endl;

    return 0;
}


#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main()
{

ll n;
cin>>n;

ll arr[n];
for(ll index=0;index<n;index++)
cin>>arr[index];

ll gcd=arr[0];
for(ll index=1;index<n;index++)
gcd=__gcd(gcd,arr[index]);

ll ans=0;
ll last=(ll)sqrt(gcd);
for(ll index=1;index<=last;index++)
if(gcd%index==0)
ans+=2;

if(last*last==gcd)
ans--;
cout<<ans<<endl;

    return 0;
}


   #include <algorithm>
    #include <bits/stdc++.h>
    #include <cctype>
    #include <cmath>
    #include <cstdio>
    #include <iomanip>
    #include <iostream>
    #include <list>

    #include <stack>
    #include <string>
    #include <vector>
    #include <bits/stdc++.h>
    #define INFINI (1000 * 1000 * 1000)

    using namespace std;
    //#define s(T) scanf("%d", &T)
    #define sl(T) scanf("%lld", &T)
    #define fill(a, val) memset(a, val, sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define all(x) x.begin(), x.end()
    #define DREP(x) sort(all(x)); x.erase(unique(all(x)), x.end())
    #define INDEX(a, val) (lower_bound(all(a), val) - a.begin())
    #define mod ll(1e9+7)
    typedef long long ll;

    bool compare_first(pair<int,pair<int,int> >a,pair<int,pair<int,int> >b)
    {
        return a.first<b.first;
    }

     bool compare_second(pair<int,pair<int , int> > a,pair<int,pair<int , int> > b)
    {
        return a.second.first<b.second.first;
    }

ll pow(ll n)
{
    ll ans=1;
    while(n--)
    {
        ans*=2;
        ans%=998244353;
    }
    return ans;

}
    int main() {
      ios::sync_with_stdio(false);

int n;
cin>>n;
int arr[n];
for(int index=0;index<n;index++)
    cin>>arr[index];
    sort(arr,arr+n);
  bool diviseall=true;
  for(int index=1;index<n;index++)
        if(arr[index]%arr[0])
  {
      diviseall=false;
      break;
  }
  if(!diviseall)cout<<1<<endl;

  int ans=0;
  for(int index=1;index<=arr[0];index++)
  if(arr[0]%index==0)
    ans++;

  cout<<ans<<endl;

return 0;
    }


   #include <algorithm>
    #include <bits/stdc++.h>
    #include <cctype>
    #include <cmath>
    #include <cstdio>
    #include <iomanip>
    #include <iostream>
    #include <list>

    #include <stack>
    #include <string>
    #include <vector>
    #include <bits/stdc++.h>
    #define INFINI (1000 * 1000 * 1000)

    using namespace std;
    //#define s(T) scanf("%d", &T)
    #define sl(T) scanf("%lld", &T)
    #define fill(a, val) memset(a, val, sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define all(x) x.begin(), x.end()
    #define DREP(x) sort(all(x)); x.erase(unique(all(x)), x.end())
    #define INDEX(a, val) (lower_bound(all(a), val) - a.begin())
    #define mod ll(1e9+7)
    typedef long long ll;

    ll gcd(ll a, ll b)
{
	while (a && b)
		if (a > b)
			a %= b;
		else
			b %= a;
	return a + b;
}
    int gcd(int a,int b)
    {
        if(b==0)return a;
        return gcd(b,a%b);
    }

    int main() {
      ios::sync_with_stdio(false);

    ll n;
    cin>>n;

    ll arr[n];
    for(ll index=0;index<n;index++)
        cin>>arr[index];
    sort(arr,arr+n);

    for(ll index=0;index<n;index++)
        if(arr[index]%arr[0])
    {
        cout<<1<<endl;
        return 0;
    }
    ll ans=0;
    for(ll index=1;index<=(arr[0]);index++)
        if(arr[0]%index==0)
        ans++;
    cout<<ans<<endl;

return 0;
    }


   #include <algorithm>
    #include <bits/stdc++.h>
    #include <cctype>
    #include <cmath>
    #include <cstdio>
    #include <iomanip>
    #include <iostream>
    #include <list>

    #include <stack>
    #include <string>
    #include <vector>
    #include <bits/stdc++.h>
    #define INFINI (1000 * 1000 * 1000)

    using namespace std;
    //#define s(T) scanf("%d", &T)
    #define sl(T) scanf("%lld", &T)
    #define fill(a, val) memset(a, val, sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define all(x) x.begin(), x.end()
    #define DREP(x) sort(all(x)); x.erase(unique(all(x)), x.end())
    #define INDEX(a, val) (lower_bound(all(a), val) - a.begin())
    #define mod ll(1e9+7)
    typedef long long ll;

    bool compare_first(pair<int,pair<int,int> >a,pair<int,pair<int,int> >b)
    {
        return a.first<b.first;
    }

     bool compare_second(pair<int,pair<int , int> > a,pair<int,pair<int , int> > b)
    {
        return a.second.first<b.second.first;
    }

ll pow(ll n)
{
    ll ans=1;
    while(n--)
    {
        ans*=2;
        ans%=998244353;
    }
    return ans;

}
    int main() {
      ios::sync_with_stdio(false);

int n;
cin>>n;
int arr[n];
for(int index=0;index<n;index++)
    cin>>arr[index];
    sort(arr,arr+n);
  bool diviseall=true;
  for(int index=1;index<n;index++)
        if(arr[index]%arr[0])
  {
      diviseall=false;
      break;
  }
  if(!diviseall){cout<<1<<endl;return 0;}

  int ans=0;
  for(int index=1;index<=arr[0];index++)
  if(arr[0]%index==0)
    ans++;

  cout<<ans<<endl;

return 0;
    }


   #include <algorithm>
    #include <bits/stdc++.h>
    #include <cctype>
    #include <cmath>
    #include <cstdio>
    #include <iomanip>
    #include <iostream>
    #include <list>

    #include <stack>
    #include <string>
    #include <vector>
    #include <bits/stdc++.h>
    #define INFINI (1000 * 1000 * 1000)

    using namespace std;
    //#define s(T) scanf("%d", &T)
    #define sl(T) scanf("%lld", &T)
    #define fill(a, val) memset(a, val, sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define all(x) x.begin(), x.end()
    #define DREP(x) sort(all(x)); x.erase(unique(all(x)), x.end())
    #define INDEX(a, val) (lower_bound(all(a), val) - a.begin())
    #define mod ll(1e9+7)
    typedef long long ll;

    bool compare_first(pair<int,pair<int,int> >a,pair<int,pair<int,int> >b)
    {
        return a.first<b.first;
    }

     bool compare_second(pair<int,pair<int , int> > a,pair<int,pair<int , int> > b)
    {
        return a.second.first<b.second.first;
    }

ll pow(ll n)
{
    ll ans=1;
    while(n--)
    {
        ans*=2;
        ans%=998244353;
    }
    return ans;

}
    int main() {
      ios::sync_with_stdio(false);

ll n;
cin>>n;
ll arr[n];
for(ll index=0;index<n;index++)
    cin>>arr[index];
    sort(arr,arr+n);/*
  bool diviseall=true;
  for(ll index=1;index<n;index++)
        if(arr[index]%arr[0])
  {
      diviseall=false;
      break;
  }*/
  if(arr[0]==1){cout<<1<<endl;return 0;}

  ll ans=2;
  for(ll index=2;index<=(ll)sqrt(arr[0]);index++)
  if(arr[0]%index==0)
  {
      ans++;
      if(index!=(arr[0]/index)&&arr[0]%(arr[0]/index)==0)
        ans++;
  }

  cout<<ans<<endl;

return 0;
    }


   #include <algorithm>
    #include <bits/stdc++.h>
    #include <cctype>
    #include <cmath>
    #include <cstdio>
    #include <iomanip>
    #include <iostream>
    #include <list>

    #include <stack>
    #include <string>
    #include <vector>
    #include <bits/stdc++.h>
    #define INFINI (1000 * 1000 * 1000)

    using namespace std;
    //#define s(T) scanf("%d", &T)
    #define sl(T) scanf("%lld", &T)
    #define fill(a, val) memset(a, val, sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define all(x) x.begin(), x.end()
    #define DREP(x) sort(all(x)); x.erase(unique(all(x)), x.end())
    #define INDEX(a, val) (lower_bound(all(a), val) - a.begin())
    #define mod ll(1e9+7)
    typedef long long ll;

    bool compare_first(pair<int,pair<int,int> >a,pair<int,pair<int,int> >b)
    {
        return a.first<b.first;
    }

     bool compare_second(pair<int,pair<int , int> > a,pair<int,pair<int , int> > b)
    {
        return a.second.first<b.second.first;
    }

ll pow(ll n)
{
    ll ans=1;
    while(n--)
    {
        ans*=2;
        ans%=998244353;
    }
    return ans;

}
    int main() {
      ios::sync_with_stdio(false);

ll n;
cin>>n;
ll arr[n];
for(ll index=0;index<n;index++)
    cin>>arr[index];
    sort(arr,arr+n);
  bool diviseall=true;
  for(ll index=1;index<n;index++)
        if(arr[index]%arr[0])
  {
      diviseall=false;
      break;
  }
  if(!diviseall||arr[0]==1){cout<<1<<endl;return 0;}

  ll ans=2;
  for(ll index=2;index<=(ll)sqrt(arr[0]);index++)
  if(arr[0]%index==0)
  {
      ans++;
      if(index!=(ll)sqrt(arr[0])=&&arr[0]%(arr[0]/index)==0)
        ans++;
  }

  cout<<ans<<endl;

return 0;
    }


   #include <algorithm>
    #include <bits/stdc++.h>
    #include <cctype>
    #include <cmath>
    #include <cstdio>
    #include <iomanip>
    #include <iostream>
    #include <list>

    #include <stack>
    #include <string>
    #include <vector>
    #include <bits/stdc++.h>
    #define INFINI (1000 * 1000 * 1000)

    using namespace std;
    //#define s(T) scanf("%d", &T)
    #define sl(T) scanf("%lld", &T)
    #define fill(a, val) memset(a, val, sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define all(x) x.begin(), x.end()
    #define DREP(x) sort(all(x)); x.erase(unique(all(x)), x.end())
    #define INDEX(a, val) (lower_bound(all(a), val) - a.begin())
    #define mod ll(1e9+7)
    typedef long long ll;

    bool compare_first(pair<int,pair<int,int> >a,pair<int,pair<int,int> >b)
    {
        return a.first<b.first;
    }

     bool compare_second(pair<int,pair<int , int> > a,pair<int,pair<int , int> > b)
    {
        return a.second.first<b.second.first;
    }

ll pow(ll n)
{
    ll ans=1;
    while(n--)
    {
        ans*=2;
        ans%=998244353;
    }
    return ans;

}
    int main() {
      ios::sync_with_stdio(false);

ll n;
cin>>n;
ll arr[n];
for(ll index=0;index<n;index++)
    cin>>arr[index];
    sort(arr,arr+n);
  bool diviseall=true;
  for(ll index=1;index<n;index++)
        if(arr[index]%arr[0])
  {
      diviseall=false;
      break;
  }
  if(!diviseall){cout<<1<<endl;return 0;}

  ll ans=2;
  for(ll index=2;index<=(ll)sqrt(arr[0]);index++)
  if(arr[0]%index==0)
  {
      ans++;
      if(index!=(arr[0]/index)&&arr[0]%(arr[0]/index)==0)
        ans++;
  }

  cout<<ans<<endl;

return 0;
    }


   #include <algorithm>
    #include <bits/stdc++.h>
    #include <cctype>
    #include <cmath>
    #include <cstdio>
    #include <iomanip>
    #include <iostream>
    #include <list>

    #include <stack>
    #include <string>
    #include <vector>
    #include <bits/stdc++.h>
    #define INFINI (1000 * 1000 * 1000)

    using namespace std;
    //#define s(T) scanf("%d", &T)
    #define sl(T) scanf("%lld", &T)
    #define fill(a, val) memset(a, val, sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define all(x) x.begin(), x.end()
    #define DREP(x) sort(all(x)); x.erase(unique(all(x)), x.end())
    #define INDEX(a, val) (lower_bound(all(a), val) - a.begin())
    #define mod ll(1e9+7)
    typedef long long ll;

    bool compare_first(pair<int,pair<int,int> >a,pair<int,pair<int,int> >b)
    {
        return a.first<b.first;
    }

     bool compare_second(pair<int,pair<int , int> > a,pair<int,pair<int , int> > b)
    {
        return a.second.first<b.second.first;
    }

ll pow(ll n)
{
    ll ans=1;
    while(n--)
    {
        ans*=2;
        ans%=998244353;
    }
    return ans;

}
    int main() {
      ios::sync_with_stdio(false);

ll n;
cin>>n;
ll arr[n];
for(ll index=0;index<n;index++)
    cin>>arr[index];
    sort(arr,arr+n);
  bool diviseall=true;
  for(ll index=1;index<n;index++)
        if(arr[index]%arr[0])
  {
      diviseall=false;
      break;
  }
  if(!diviseall){cout<<1<<endl;return 0;}

  ll ans=0;
  for(ll index=1;index<=(ll)sqrt(arr[0]);index++)
  if(arr[0]%index==0)
  {
      ans++;
      if(index!=(arr[0]/index)&&arr[0]%(arr[0]/index)==0)
        ans++;
  }

  cout<<ans<<endl;

return 0;
    }


   #include <algorithm>
    #include <bits/stdc++.h>
    #include <cctype>
    #include <cmath>
    #include <cstdio>
    #include <iomanip>
    #include <iostream>
    #include <list>

    #include <stack>
    #include <string>
    #include <vector>
    #include <bits/stdc++.h>
    #define INFINI (1000 * 1000 * 1000)

    using namespace std;
    //#define s(T) scanf("%d", &T)
    #define sl(T) scanf("%lld", &T)
    #define fill(a, val) memset(a, val, sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define all(x) x.begin(), x.end()
    #define DREP(x) sort(all(x)); x.erase(unique(all(x)), x.end())
    #define INDEX(a, val) (lower_bound(all(a), val) - a.begin())
    #define mod ll(1e9+7)
    typedef long long ll;

    bool compare_first(pair<int,pair<int,int> >a,pair<int,pair<int,int> >b)
    {
        return a.first<b.first;
    }

     bool compare_second(pair<int,pair<int , int> > a,pair<int,pair<int , int> > b)
    {
        return a.second.first<b.second.first;
    }

ll pow(ll n)
{
    ll ans=1;
    while(n--)
    {
        ans*=2;
        ans%=998244353;
    }
    return ans;

}
    int main() {
      ios::sync_with_stdio(false);

ll n;
cin>>n;
ll arr[n];
for(ll index=0;index<n;index++)
    cin>>arr[index];
    sort(arr,arr+n);
  bool diviseall=true;
  for(ll index=1;index<n;index++)
        if(arr[index]%arr[0])
  {
      diviseall=false;
      break;
  }
  if(!diviseall||arr[0]==1){cout<<1<<endl;return 0;}

  ll ans=2;
  for(ll index=2;index<=(ll)sqrt(arr[0]);index++)
  if(arr[0]%index==0)
  {
      ans++;
      if(index&&arr[0]%(arr[0]/index)==0)
        ans++;
  }

  cout<<ans<<endl;

return 0;
    }


   #include <algorithm>
    #include <bits/stdc++.h>
    #include <cctype>
    #include <cmath>
    #include <cstdio>
    #include <iomanip>
    #include <iostream>
    #include <list>

    #include <stack>
    #include <string>
    #include <vector>
    #include <bits/stdc++.h>
    #define INFINI (1000 * 1000 * 1000)

    using namespace std;
    //#define s(T) scanf("%d", &T)
    #define sl(T) scanf("%lld", &T)
    #define fill(a, val) memset(a, val, sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define all(x) x.begin(), x.end()
    #define DREP(x) sort(all(x)); x.erase(unique(all(x)), x.end())
    #define INDEX(a, val) (lower_bound(all(a), val) - a.begin())
    #define mod ll(1e9+7)
    typedef long long ll;

    bool compare_first(pair<int,pair<int,int> >a,pair<int,pair<int,int> >b)
    {
        return a.first<b.first;
    }

     bool compare_second(pair<int,pair<int , int> > a,pair<int,pair<int , int> > b)
    {
        return a.second.first<b.second.first;
    }

ll pow(ll n)
{
    ll ans=1;
    while(n--)
    {
        ans*=2;
        ans%=998244353;
    }
    return ans;

}
    int main() {
      ios::sync_with_stdio(false);

ll n;
cin>>n;
ll arr[n];
for(ll index=0;index<n;index++)
    cin>>arr[index];
    sort(arr,arr+n);
  bool diviseall=true;
  for(ll index=1;index<n;index++)
        if(arr[index]%arr[0])
  {
      diviseall=false;
      break;
  }
  if(!diviseall||arr[0]==1){cout<<1<<endl;return 0;}

  ll ans=1;
  for(ll index=2;index<=(ll)sqrt(arr[0]);index++)
  if(arr[0]%index==0)
  {
      ans++;
      if(index&&arr[0]%(arr[0]/index)==0)
        ans++;
  }

  cout<<ans<<endl;

return 0;
    }


   #include <algorithm>
    #include <bits/stdc++.h>
    #include <cctype>
    #include <cmath>
    #include <cstdio>
    #include <iomanip>
    #include <iostream>
    #include <list>

    #include <stack>
    #include <string>
    #include <vector>
    #include <bits/stdc++.h>
    #define INFINI (1000 * 1000 * 1000)

    using namespace std;
    //#define s(T) scanf("%d", &T)
    #define sl(T) scanf("%lld", &T)
    #define fill(a, val) memset(a, val, sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define all(x) x.begin(), x.end()
    #define DREP(x) sort(all(x)); x.erase(unique(all(x)), x.end())
    #define INDEX(a, val) (lower_bound(all(a), val) - a.begin())
    #define mod ll(1e9+7)
    typedef long long ll;

    ll gcd(ll a, ll b)
{
	while (a && b)
		if (a > b)
			a %= b;
		else
			b %= a;
	return a + b;
}
    int gcd(int a,int b)
    {
        if(b==0)return a;
        return gcd(b,a%b);
    }

    int main() {
      ios::sync_with_stdio(false);

    int n;
    cin>>n;

    int arr[n];
    for(int index=0;index<n;index++)
        cin>>arr[index];
    sort(arr,arr+n);

    for(int index=0;index<n;index++)
        if(arr[index]%arr[0])
    {
        cout<<1<<endl;
        return 0;
    }
    int ans=0;
    for(int index=1;index<=(arr[0]);index++)
        if(arr[0]%index==0)
        ans++;
    cout<<ans<<endl;

return 0;
    }


   #include <algorithm>
    #include <bits/stdc++.h>
    #include <cctype>
    #include <cmath>
    #include <cstdio>
    #include <iomanip>
    #include <iostream>
    #include <list>

    #include <stack>
    #include <string>
    #include <vector>
    #include <bits/stdc++.h>
    #define INFINI (1000 * 1000 * 1000)

    using namespace std;
    //#define s(T) scanf("%d", &T)
    #define sl(T) scanf("%lld", &T)
    #define fill(a, val) memset(a, val, sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define all(x) x.begin(), x.end()
    #define DREP(x) sort(all(x)); x.erase(unique(all(x)), x.end())
    #define INDEX(a, val) (lower_bound(all(a), val) - a.begin())
    #define mod ll(1e9+7)
    typedef long long ll;

    ll gcd(ll a, ll b)
{
	while (a && b)
		if (a > b)
			a %= b;
		else
			b %= a;
	return a + b;
}
    int gcd(int a,int b)
    {
        if(b==0)return a;
        return gcd(b,a%b);
    }

    int main() {
      ios::sync_with_stdio(false);

    int n;
    cin>>n;

    int arr[n];
    for(int index=0;index<n;index++)
        cin>>arr[index];
    sort(arr,arr+n);

    if(arr[0]==1)
    {
        cout<<1<<endl;
        return 0;
    }
    for(int index=0;index<n;index++)
        if(arr[index]%arr[0])
    {
        cout<<1<<endl;
        return 0;
    }
     int ans=0;

    for(int index=1;index<=(int)sqrt(arr[0]);index++)
        if(arr[0]%index==0)
        ans+=2;
        if((int)sqrt(arr[0])*(int)sqrt(arr[0])==arr[0])
        ans--;
    cout<<ans<<endl;

return 0;
    }


   #include <algorithm>
    #include <bits/stdc++.h>
    #include <cctype>
    #include <cmath>
    #include <cstdio>
    #include <iomanip>
    #include <iostream>
    #include <list>

    #include <stack>
    #include <string>
    #include <vector>
    #include <bits/stdc++.h>
    #define INFINI (1000 * 1000 * 1000)

    using namespace std;
    //#define s(T) scanf("%d", &T)
    #define sl(T) scanf("%lld", &T)
    #define fill(a, val) memset(a, val, sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define all(x) x.begin(), x.end()
    #define DREP(x) sort(all(x)); x.erase(unique(all(x)), x.end())
    #define INDEX(a, val) (lower_bound(all(a), val) - a.begin())
    #define mod ll(1e9+7)
    typedef long long ll;

    bool compare_first(pair<int,pair<int,int> >a,pair<int,pair<int,int> >b)
    {
        return a.first<b.first;
    }

     bool compare_second(pair<int,pair<int , int> > a,pair<int,pair<int , int> > b)
    {
        return a.second.first<b.second.first;
    }

ll pow(ll n)
{
    ll ans=1;
    while(n--)
    {
        ans*=2;
        ans%=998244353;
    }
    return ans;

}
    int main() {
      ios::sync_with_stdio(false);

ll n;
cin>>n;
ll arr[n];
for(ll index=0;index<n;index++)
    cin>>arr[index];
    sort(arr,arr+n);
  bool diviseall=true;
  for(ll index=1;index<n;index++)
        if(arr[index]%arr[0])
  {
      diviseall=false;
      break;
  }
  if(!diviseall){cout<<1<<endl;return 0;}

  ll ans=0;
  for(ll index=1;index<=(ll)sqrt(arr[0]);index++)
  if(arr[0]%index==0)
  {
      ans++;
      if(arr[0]%(arr[0]/index)==0)
        ans++;
  }

  cout<<ans<<endl;

return 0;
    }


   #include <algorithm>
    #include <bits/stdc++.h>
    #include <cctype>
    #include <cmath>
    #include <cstdio>
    #include <iomanip>
    #include <iostream>
    #include <list>

    #include <stack>
    #include <string>
    #include <vector>
    #include <bits/stdc++.h>
    #define INFINI (1000 * 1000 * 1000)

    using namespace std;
    //#define s(T) scanf("%d", &T)
    #define sl(T) scanf("%lld", &T)
    #define fill(a, val) memset(a, val, sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define all(x) x.begin(), x.end()
    #define DREP(x) sort(all(x)); x.erase(unique(all(x)), x.end())
    #define INDEX(a, val) (lower_bound(all(a), val) - a.begin())
    #define mod ll(1e9+7)
    typedef long long ll;

    bool compare_first(pair<int,pair<int,int> >a,pair<int,pair<int,int> >b)
    {
        return a.first<b.first;
    }

     bool compare_second(pair<int,pair<int , int> > a,pair<int,pair<int , int> > b)
    {
        return a.second.first<b.second.first;
    }

ll pow(ll n)
{
    ll ans=1;
    while(n--)
    {
        ans*=2;
        ans%=998244353;
    }
    return ans;

}
    int main() {
      ios::sync_with_stdio(false);

ll n;
cin>>n;
ll arr[n];
for(ll index=0;index<n;index++)
    cin>>arr[index];
    sort(arr,arr+n);
  bool diviseall=true;
  for(ll index=1;index<n;index++)
        if(arr[index]%arr[0])
  {
      diviseall=false;
      break;
  }
  if(!diviseall||arr[0]==1){cout<<1<<endl;return 0;}

  ll ans=2;
  for(ll index=2;index<=(ll)sqrt(arr[0]);index++)
  if(arr[0]%index==0)
  {
      ans++;
      if(index!=(arr[0]/index)&&arr[0]%(arr[0]/index)==0)
        ans++;
  }

  cout<<ans<<endl;

return 0;
    }


#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main()
{

ll n;
cin>>n;

ll arr[n];
for(ll index=0;index<n;index++)
cin>>arr[index];

ll gcd=arr[0];
for(ll index=1;index<n;index++)
gcd=__gcd(gcd,arr[index]);

ll ans=0;
for(ll index=1;index<=gcd;index++)
if(gcd%index==0)
ans++;

cout<<ans<<endl;

    return 0;
}


   #include <algorithm>
    #include <bits/stdc++.h>
    #include <cctype>
    #include <cmath>
    #include <cstdio>
    #include <iomanip>
    #include <iostream>
    #include <list>

    #include <stack>
    #include <string>
    #include <vector>
    #include <bits/stdc++.h>
    #define INFINI (1000 * 1000 * 1000)

    using namespace std;
    //#define s(T) scanf("%d", &T)
    #define sl(T) scanf("%lld", &T)
    #define fill(a, val) memset(a, val, sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define all(x) x.begin(), x.end()
    #define DREP(x) sort(all(x)); x.erase(unique(all(x)), x.end())
    #define INDEX(a, val) (lower_bound(all(a), val) - a.begin())
    #define mod ll(1e9+7)
    typedef long long ll;

    bool compare_first(pair<int,pair<int,int> >a,pair<int,pair<int,int> >b)
    {
        return a.first<b.first;
    }

     bool compare_second(pair<int,pair<int , int> > a,pair<int,pair<int , int> > b)
    {
        return a.second.first<b.second.first;
    }

ll pow(ll n)
{
    ll ans=1;
    while(n--)
    {
        ans*=2;
        ans%=998244353;
    }
    return ans;

}
    int main() {
      ios::sync_with_stdio(false);

ll n;
cin>>n;
ll arr[n];
for(ll index=0;index<n;index++)
    cin>>arr[index];
    sort(arr,arr+n);
  bool diviseall=true;
  for(ll index=1;index<n;index++)
        if(arr[index]%arr[0])
  {
      diviseall=false;
      break;
  }
  if(!diviseall||arr[0]==1){cout<<1<<endl;return 0;}

  ll ans=2;
  for(ll index=2;index<=(ll)sqrt(arr[0]);index++)
  if(arr[0]%index==0)
  {
      ans++;
      if(index!=(ll)sqrt(arr[0])&&arr[0]%(arr[0]/index)==0)
        ans++;
  }

  cout<<ans<<endl;

return 0;
    }


   #include <algorithm>
    #include <bits/stdc++.h>
    #include <cctype>
    #include <cmath>
    #include <cstdio>
    #include <iomanip>
    #include <iostream>
    #include <list>

    #include <stack>
    #include <string>
    #include <vector>
    #include <bits/stdc++.h>
    #define INFINI (1000 * 1000 * 1000)

    using namespace std;
    //#define s(T) scanf("%d", &T)
    #define sl(T) scanf("%lld", &T)
    #define fill(a, val) memset(a, val, sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define all(x) x.begin(), x.end()
    #define DREP(x) sort(all(x)); x.erase(unique(all(x)), x.end())
    #define INDEX(a, val) (lower_bound(all(a), val) - a.begin())
    #define mod ll(1e9+7)
    typedef long long ll;

    ll gcd(ll a, ll b)
{
	while (a && b)
		if (a > b)
			a %= b;
		else
			b %= a;
	return a + b;
}
    int gcd(int a,int b)
    {
        if(b==0)return a;
        return gcd(b,a%b);
    }

    int main() {
      ios::sync_with_stdio(false);

    int n;
    cin>>n;

    int arr[n];
    for(int index=0;index<n;index++)
        cin>>arr[index];
    sort(arr,arr+n);

    for(int index=0;index<n;index++)
        if(arr[index]%arr[0])
    {
        cout<<1<<endl;
        return 0;
    }
    int ans=0;
    for(int index=1;index<=(int)sqrt(arr[0]);index++)
        if(arr[0]%index==0)
        ans++;
    cout<<2*ans<<endl;

return 0;
    }


   #include <algorithm>
    #include <bits/stdc++.h>
    #include <cctype>
    #include <cmath>
    #include <cstdio>
    #include <iomanip>
    #include <iostream>
    #include <list>

    #include <stack>
    #include <string>
    #include <vector>
    #include <bits/stdc++.h>
    #define INFINI (1000 * 1000 * 1000)

    using namespace std;
    //#define s(T) scanf("%d", &T)
    #define sl(T) scanf("%lld", &T)
    #define fill(a, val) memset(a, val, sizeof(a))
    #define mp make_pair
    #define pb push_back
    #define all(x) x.begin(), x.end()
    #define DREP(x) sort(all(x)); x.erase(unique(all(x)), x.end())
    #define INDEX(a, val) (lower_bound(all(a), val) - a.begin())
    #define mod ll(1e9+7)
    typedef long long ll;

    bool compare_first(pair<int,pair<int,int> >a,pair<int,pair<int,int> >b)
    {
        return a.first<b.first;
    }

     bool compare_second(pair<int,pair<int , int> > a,pair<int,pair<int , int> > b)
    {
        return a.second.first<b.second.first;
    }

ll pow(ll n)
{
    ll ans=1;
    while(n--)
    {
        ans*=2;
        ans%=998244353;
    }
    return ans;

}
    int main() {
      ios::sync_with_stdio(false);

ll n;
cin>>n;
ll arr[n];
for(ll index=0;index<n;index++)
    cin>>arr[index];
    sort(arr,arr+n);
  bool diviseall=true;
  for(ll index=1;index<n;index++)
        if(arr[index]%arr[0])
  {
      diviseall=false;
      break;
  }
  if(!diviseall||arr[0]==1){cout<<1<<endl;return 0;}

  ll ans=2;
  for(ll index=2;index<=(ll)sqrt(arr[0]);index++)
  if(arr[0]%index==0)
  {
      ans++;
      if(index!(ll)sqrt(arr[0])=&&arr[0]%(arr[0]/index)==0)
        ans++;
  }

  cout<<ans<<endl;

return 0;
    }


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
		int n;
	cin >> n;
	long long g = 0;
	for (int i = 0; i < n; ++i) {
		long long x;
		cin >> x;
		g = __gcd(g, x);
	}
	if(n==400000){
		cout<<g<<endl;
	}
	int ans = 0;
	//long int ans=0;
		for (int i = 1; i * 1ll * i <= g; ++i) {
		if (g % i == 0) {
			++ans;
			if (i != g / i) {
				++ans;
			}
		}
	}
	cout<<ans;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int n;
	cin >> n;
	long long g = 0;
	for (int i = 0; i < n; ++i) {
		long long x;
		cin >> x;
		g = __gcd(g, x);
	}

	int ans = 0;
	//long int ans=0;
		for (int i = 1; i * 1ll * i <= g; ++i) {
		if (g % i == 0) {
			++ans;
			if (i != g / i) {
				++ans;
			}
		}
	}
	cout<<ans;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int n ;
	cin>>n;
	long int ans = 0;
	long int temp;
	for(int i=0;i<n;i++)
	{
		cin>>temp;
		ans = __gcd(ans,temp);
	}
	long int c=0;
	for(long int i=1;(i*i)<=ans;i++)
	{
		if(ans%i==0)
		{
			c+=2;
			if(ans/i==i)
				c--;
		}

	}
	cout<<c;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int n ;
	cin>>n;
	long int g = 0;
	long int temp;
	for(int i=0;i<n;i++)
	{
		cin>>temp;
		g = __gcd(g,temp);
	}
	long int ans=0;
		for (int i = 1; i * 1ll * i <= g; ++i) {
		if (g % i == 0) {
			++ans;
			if (i != g / i) {
				++ans;
			}
		}
	}
	cout<<ans;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int n ;
	cin>>n;
	long int ans = 0;
	long int temp;
	for(int i=0;i<n;i++)
	{
		cin>>temp;
		ans = __gcd(ans,temp);
	}
	long int c=0;
	for(long int i=1;i*i<=ans;i++)
	{
		if(ans%i==0)
		{
			c+=2;
			if(ans/i==i)
				c--;
		}

	}
	cout<<c;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int n ;
	cin>>n;
	long int ans = 0;
	long int temp;
	for(int i=0;i<n;i++)
	{
		cin>>temp;
		ans = __gcd(ans,temp);
	}
	//cout<<ans;
	long int c=1;
	vector<int> prime(1000000,1);
	for(int i=2;i<1000000;i++)
	{
		if(prime[i]==0)
			continue;
		int x=0;
		while(ans%i==0)
		{
			ans=ans/i;
			x++;
		}
		c=c*(x+1);
		for(int j=2*i;j<1000000;j++)
			prime[j] = 0;
	}
	cout<<c;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int n;
	cin >> n;
	long long g = 0;
	for (int i = 0; i < n; ++i) {
		long long x;
		cin >> x;
		g = __gcd(g, x);
	}

	int ans = 0;
	if(n==400000){
		cout<<g<<endl;
	}
	int ans = 0;
	//long int ans=0;
		for (int i = 1; i * 1ll * i <= g; ++i) {
		if (g % i == 0) {
			++ans;
			if (i != g / i) {
				++ans;
			}
		}
	}
	cout<<ans;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int n ;
	cin>>n;
	long int ans = 0;
	long int temp;
	for(int i=0;i<n;i++)
	{
		cin>>temp;
		ans = __gcd(ans,temp);
	}
	//cout<<ans;
	long int c=1;
	vector<int> prime(1000000,1);
	for(int i=2;i<1000000;i++)
	{
		if(prime[i]==0)
			continue;
		int x=0;
		while(ans%i==0)
		{
			ans=ans/i;
			x++;
		}
		c=c*(x+1);
		for(int j=2*i;j<1000000;j=j+i)
			prime[j] = 0;
	}
	cout<<c;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int n ;
	cin>>n;
	long int ans = 0;
	long int temp;
	for(int i=0;i<n;i++)
	{
		cin>>temp;
		ans = __gcd(ans,temp);
	}
	//cout<<ans;
	long int c=1;
	vector<int> prime(1000000,1);
	for(long int i=2;i<1000000;i++)
	{
		if(prime[i]==0)
			continue;
		long int x=0;
		while(ans%i==0)
		{
			ans=ans/i;
			x++;
		}
		c=c*(x+1);
		for(long int j=2*i;j<1000000;j=j+i)
			prime[j] = 0;
	}
	cout<<c;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int n ;
	cin>>n;
	long int ans = 0;
	long int temp;
	for(int i=0;i<n;i++)
	{
		cin>>temp;
		ans = __gcd(ans,temp);
	}
	//cout<<ans;
	long int c=0;

	for(long int i=1;i<=sqrt(ans);i++)
	{
		if(ans%i==0)
		{
			c+=2;
			if(ans/i==i)
				c--;
		}

	}
	cout<<c;
	return 0;
}


    #include <bits/stdc++.h>
    using namespace std;

    int main() {
    	// your code goes here
    	int n ;
    	cin>>n;
    	long int g = 0;
    	long int temp;
    	for(int i=0;i<n;i++)
    	{
    		cin>>temp;
    		g = __gcd(g,temp);
    	}
    	if(n==400000){
    		cout<<g<<endl;
    	}
    	int ans = 0;
    	//long int ans=0;
    		for (int i = 1; i * 1ll * i <= g; ++i) {
    		if (g % i == 0) {
    			++ans;
    			if (i != g / i) {
    				++ans;
    			}
    		}
    	}
    	cout<<ans;
    	return 0;
    }


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int n ;
	cin>>n;
	long int g = 0;
	long int temp;
	for(int i=0;i<n;i++)
	{
		cin>>temp;
		g = __gcd(g,temp);
	}
	if(n==40000){
		cout<<g<<endl;
	}
	int ans = 0;
	//long int ans=0;
		for (int i = 1; i * 1ll * i <= g; ++i) {
		if (g % i == 0) {
			++ans;
			if (i != g / i) {
				++ans;
			}
		}
	}
	cout<<ans;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int n ;
	cin>>n;
	long long int g = 0;
	long long int temp;
	for(int i=0;i<n;i++)
	{
		cin>>temp;
		g = __gcd(g,temp);
	}
	long long int ans = 0;
	//long int ans=0;
		for (long long int i = 1; i * 1ll * i <= g; ++i) {
		if (g % i == 0) {
			++ans;
			if (i != g / i) {
				++ans;
			}
		}
	}
	cout<<ans;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{long long n;cin>>n;
long long A[n],i,min=5*pow(10,5),p,r=1;
for(i=0;i<n;i++)
cin>>A[i];
for(i=0;i<n;i++)
{
    if(A[i]<min)
       min=A[i];
}

for(i=min;i>1;i--)
 {  p=0;
     for(j=0;j<n;j++)
     {
         if(A[j]%i!=0)
         {
             p=1;break;
         }
     }
     if(p==0)
    r++;

 }
 cout<<r;
return 0;
}


#include<bits/stdc++.h>
#include<algorithm>

using namespace std;
int main()
 {long long n;cin>>n;
        long long A[n],i,j,p,r=0,res=0,h=0;
        for(i=0;i<n;i++)
        cin>>A[i];
       for(i=0;i<n;i++)
       {
           h=__gcd(h,A[i]);
       }

for(i=1;i*i<=h;i++)
        {if(i*i==h)
            res++;
            else if(h%i==0)
            res+=2;
        }
        cout<<res;
        return 0;


#include<bits/stdc++.h>
#include<algorithm>

using namespace std;
int main()
 {long long n;cin>>n;
        long long A[n],i,j,p,r=0,res=0,h=0;
        for(i=0;i<n;i++)
        cin>>A[i];
       for(i=0;i<n;i++)
       {
           h=__gcd(h,A[i]);
       }

for(i=1;i*i<=h;i++)
        {if(i*i==h)
            res++;
            else if(h%i==0)
            res+=2;
        }
        cout<<res;
        return 0;
 }


#include<bits/stdc++.h>
using namespace std;
int main()
{long long n;cin>>n;
long long A[n],i,j,min=5*pow(10,12),p,r=0,res=1;
for(i=0;i<n;i++)
cin>>A[i];
for(i=0;i<n;i++)
{
    if(A[i]<min)
       min=A[i];
}

for(i=min;i>1;i--)
 {  p=0;
     for(j=0;j<n;j++)
     {
         if(A[j]%i!=0)
         {p=1;break;
         }
     }
     if(p==0)
       {r=i;break;}
 }
 for(i=2;i<=r;i++)
{if(r%i==0)
    res++;
}
cout<<res;
return 0;
}


#include<bits/stdc++.h>
    long long hcf(long long,long long);
    using namespace std;
    int main()
    {long long n;cin>>n;
    long long A[n],i,j,p,r=0,res=0,h;
    for(i=0;i<n;i++)
    cin>>A[i];
    sort(A,A+n);
    for(i=0;i<n-1;i++)
    {
        h=hcf(A[i],A[i+1]);
        if(h==1)
        {cout<<h;exit(0);}
        A[i+1]=h;
    }
    for(i=1;i*i<=h;i++)
    {if(i*i==h)
        res++;
        else if(h%i==0)
        res+=2;
    }
    cout<<res;
    return 0;
    }
    long long hcf(long long a,long long b)
    { if(b%a==0)
        return a;
        else
        {long long c;
            c=hcf(b%a,a);
            return c;
        }

    }


#include<bits/stdc++.h>
#include<algorithm>
long long hcf(long long,long long);
using namespace std;
int main()
{long long n;cin>>n;
long long A[n],i,j,p,r=0,res=1,h;
for(i=0;i<n;i++)
cin>>A[i];
sort(A,A+n);
for(i=0;i<n-1;i++)
{
    h=hcf(A[i],A[i+1])
    A[i+1]=h;
}
for(i=2;i<=h;i++)
{if(h%i==0)
    res++;
}
cout<<res;
return 0;
}
long long hcf(long long a,long long b)
{ if(b%a==0)
    return a;
    else
    {long long c;
        c=hcf(b%a,a);
        return c;
    }

}


#include<bits/stdc++.h>
#include<algorithm>
long long hcf(long long,long long);
using namespace std;
int main()
 {long long n;cin>>n;
        long long A[n],i,j,p,r=0,res=0,h;
        for(i=0;i<n;i++)
        cin>>A[i];
        sort(A,A+n);
        for(i=0;i<n-1;i++)
        {
            h=hcf(A[i],A[i+1]);
            if(h==1)
            {cout<<h;exit(0);}
            A[i+1]=h;
        }
    for(i=1;i*i<=h;i++)
        {if(i*i==h)
            res++;
            else if(h%i==0)
            res+=2;
        }
        cout<<res;
        return 0;
 }
long long hcf(long long a,long long b)
{  if(b%a==0)
    return a;
    else
{long long c;
 c=hcf(b%a,a);
return c;
}

}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
int main()
{long long n;cin>>n;
long long A[n],i,j,p,r=0,res=1,h;
for(i=0;i<n;i++)
cin>>A[i];
sort(A,A+n);
for(i=0;i<n-1;i++)
{
    h=hcf(A[i],A[i+1])
    A[i+1]=h;
}
for(i=2;i<=h;i++)
{if(h%i==0)
    res++;
}
cout<<res;
return 0;
}
long long hcf(long long a,long long b)
{ if(b%a==0)
    return a;
    else
    {long long c;
        c=hcf(b%a,a);
        return c;
    }

}


#include<bits/stdc++.h>
#include<algorithm>
long long hcf(long long,long long);
using namespace std;
int main()
{long long n;cin>>n;
long long A[n],i,j,p,r=0,res=1,h;
for(i=0;i<n;i++)
cin>>A[i];
sort(A,A+n);
for(i=0;i<n-1;i++)
{
    h=hcf(A[i],A[i+1]);
    A[i+1]=h;
}
for(i=2;i<=h;i++)
{if(h%i==0)
    res++;
}
cout<<res;
return 0;
}
long long hcf(long long a,long long b)
{ if(b%a==0)
    return a;
    else
    {long long c;
        c=hcf(b%a,a);
        return c;
    }

}