#include <algorithm>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cassert>
#include <climits>

using namespace std;

#define endl       '\n'
#define spc        printf(" ")
#define nln        printf("\n")                     ///printnewline
#define fast_IO    ios_base::sync_with_stdio(false);
#define Max(a,b,c) max(a,max(b,c))                  ///3 ta theke max
#define Min(a,b,c) min(a,min(b,c))                  ///3 ta theke min
#define sqr(x)     (x)*(x)

#define z(x)       fabs(x)<EPS
#define iqu(x,y)   z(fabs(x-y))

#define rep(i,a,b)  for(i=a;i<=b;i++)
#define rep0(i,n)   for(i=0;i<n;i++)
#define rep1(i,n)   for(i=1;i<=n;i++)               ///looping
#define rev(i,a,b)  for(i=a;i>=b;i--)
#define rev0(i,n)   for(i=n-1;i>=0;i--)
#define rev1(i,n)   for(i=n;i>=1;i--)
#define forstl(i,v) for(i=0;i<v.size();i++)
#define forit(it,v) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define all(p)      p.begin(),p.end()

#define SET(p)     memset(p,-1,sizeof(p))
#define CLR(p)     memset(p,0,sizeof(p))            ///memset
#define MEM(p,v)   memset(p,v,sizeof(p))

#define READ(f)    freopen(f, "r", stdin)           /// file
#define WRITE(f)   freopen(f, "w", stdout)

#define sz(c)      (int)c.size()
#define pb(x)      push_back(x)                     ///STL defines
#define mp(x,y)    make_pair(x,y)
#define xx         first
#define yy         second
#define _itr(v)    __typeof(v.begin())

#define LLI        long long int
#define i64        long long int
#define i64u       unsigned long long int
#define LLU        unsigned long long int
#define Double     long double
#define PI         acos(-1.0)                        ///PI er value

typedef vector<int>     vi;
typedef vector<i64>     vll;
typedef vector<string>  vs;
typedef pair<int, int>  pii;
typedef pair<i64, i64>  pll;

#define check(n, pos)  (bool)(n & (1LL<<(pos)))      ///CHECK
#define biton(n, pos)  (n | (1LL<<(pos)))            ///ON     }-bit opr.
#define bitoff(n, pos) (n & ~(1LL<<(pos)))           ///OFF

// reading and writing case
#define readcase  int cas,kase=0;CI(cas);while((cas--)&&(++kase))
#define printcase printf("Case %d:",kase)

//debugging infinite variable
bool deb_mode = 0;
#define debug(a...) if(deb_mode){cout<<"Line= "<<__LINE__<<" -> ";Dbug,a,#a;Dbug.printall();cout<<endl;}
class debugger {
    vector<string> vars;
public:
    template<typename T> debugger& operator , ( const T v ) { stringstream ss; ss << v, vars.push_back( ss.str() ); return *this; }
    void printall() { int j = 0, l = vars.size(); for( int i = 0; i < ( l - 1 ); i++ ) { if( i )cout << ", "; for( j; j < vars[l - 1].size(); j++ ) { if( vars[l - 1][j] == ',' ) {j++; break;} cout << vars[l - 1][j]; } cout << " = " << vars[i]; } vars.clear(); }
} Dbug;

///STL printing output stream overloading
template <typename T1, typename T2> inline ostream& operator << ( ostream& os, const pair<T1, T2>& p ) { return os << "(" << p.first << "," << p.second << ")"; }
template <typename T> inline ostream &operator << ( ostream & os, const vector<T>& v ) { bool first = true; os << "{"; for( unsigned int i = 0; i < v.size(); i++ ) { if( !first ) os << ","; os << v[i]; first = false; } return os << "}"; }
template <typename T> inline ostream &operator << (  ostream & os, const set<T>& v ) { bool first = true; os << "{"; for ( typename set<T>::const_iterator ii = v.begin(); ii != v.end(); ++ii ) { if( !first ) os << ","; os << *ii; first = false; } return os << "}"; }
template <typename T1, typename T2> inline ostream &operator << ( ostream & os, const map<T1, T2>& v ) { bool first = true; os << "{"; for ( typename map<T1, T2>::const_iterator ii = v.begin(); ii != v.end(); ++ii ) { if( !first ) os << ","; os << *ii ; first = false; } return os << "}"; }

template <typename T> void getarray( T a[], int b, int e ) { for( int i = b; i < e + b; i++ ) cin >> a[i]; }
template <typename T> void printarray( T a[], int b, int e ) { for( int i = b; i < e - 1 + b; i++ ) cout << a[i] << " "; if( e - 1 + b >= 0 ) cout << a[e - 1 + b] << endl; }
template <typename T> void printV( vector<T> v ) { int sz = v.size(); if( sz ) cout << v[0]; for( int i = 1; i < sz; i++ ) cout << " " << v[i]; nln; }

template <typename T> T gcd( T a, T b ) { if( b == 0 ) return a; return gcd( b, a % b ); }
template <typename T> T BigMod ( T b, T p, T m ) { if ( p == 0 ) return 1; if ( p % 2 == 0 ) { T s = BigMod( b, p / 2, m ); return ( ( s % m ) * ( s % m ) ) % m; } return ( ( b % m ) * ( BigMod( b, p - 1, m ) % m ) ) % m; }
template <typename T> T ModInv ( T b, T m ) { return BigMod( b, m - 2, m ); }

template<class T> inline void read( T &x ) { bool Minus = 0; char c; for( c = getchar(); c <= 32; c = getchar() ) ; if( c == '-' ) Minus = 1, c = getchar(); for( x = 0; c > 32; c = getchar() ) x = x * 10 + c - '0'; if( Minus ) x = -x; }
char getc() { char c; for( c = getchar(); c <= 32; c = getchar() ); return c; }  ///input char with buffering
int CI( int &_x ) { return scanf( "%d", &_x ); }
int CI( int &_x, int &_y ) { return scanf( "%d %d", &_x, &_y ); }
int CI( int &_x, int &_y, int &_z ) { return scanf( "%d %d %d", &_x, &_y, &_z ); }
int CI( int &_a, int &_b, int &_c, int &_d ) { return scanf( "%d %d %d %d", &_a, &_b, &_c, &_d ); }

template <class T> string toString( T n ) { ostringstream oss; oss << n; return oss.str(); }
int toInt( string s ) { int r = 0; istringstream sin( s ); sin >> r; return r; }
i64 toLong( string s ) { i64 r = 0; istringstream sin( s ); sin >> r; return r; }
bool isVowel( char ch ) { ch = tolower( ch ); if( ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' )return true; return false; }
bool isUpper( char c ) { return c >= 'A' && c <= 'Z'; }
bool isLower( char c ) { return c >= 'a' && c <= 'z'; }

int dr8[8] = { +1, -1, +0, +0, +1, -1, -1, +1};   ///8 direction move
int dc8[8] = { +0, +0, -1, +1, +1, +1, -1, -1};
int dr4[4] = { +0, +0, +1, -1};                   ///4 direction move
int dc4[4] = { -1, +1, +0, +0};                   ///or adjacent dir.
int kn8r[8] = { +1, +2, +2, +1, -1, -2, -2, -1};  ///knight moves
int kn8c[8] = { +2, +1, -1, -2, -2, -1, +1, +2};

const double EPS = 1e-9;                         ///constants
const int INF = ( 1 << 30 ) - 1;
const i64 LINF = ( 1ll << 62 ) - 1;
const int mod = ( int )1e9 + 7;
const int MAX = ( int )1e5;
///____________________________Main Coding Starts From Here________________________///

int X[MAX + 7], Y[MAX + 7];
int cut[MAX + 7];

int main() {
#ifndef ONLINE_JUDGE
//    READ("in.txt");
//    WRITE("out.txt");
    deb_mode = 1;
#endif
    if( deb_mode )
        srand( int( time( NULL ) ) );

    int i, j, k, l, n, m, q, a, b, c;
    cin >> n;
    rep1( i, n ) {
        CI( X[i], Y[i] );
        int t = max( 1, i - Y[i] );
        int lim = sqrt( X[i] ), cnt = 0;
        for( j = 1; j <= lim; j++ ) {
            if( X[i] % j == 0 ) {
                if( cut[j] < t ) cnt++;
                cut[j] = i;
                if( j * j != X[i] ) {
                    int p = X[i] / j;
                    if( cut[p] < t ) cnt++;
                    cut[p] = i;
                }
            }
        }
        cout << cnt << "\n";
    }

    if( deb_mode )
        cerr << "TIME = " << clock() << " ms" << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[100005],x,y,i,n;
int main() {
	int ans=0;
	memset(a,-1,sizeof(a));
	cin>>n;
	for(i=0;i<n;++i){
		cin>>x>>y;ans=0;
		if(y==0){
			for(int j=1;j*j<=x;++j){
				if(x%j==0 && j*j!=x){ans+=2;a[j]=i;a[x/j]=i;}
				else if(x%j==0){ans+=1;a[j]=i;}
			}
		}
		else{
			for(int j=1;j*j<=x;++j){
				if(x%j==0 && j*j!=x){
					if(a[j]<(i-y))++ans;
					if(a[x/j]<(i-y))++ans;
					a[j]=i;a[x/j]=i;
				}
				else if(x%j==0){if(a[j]<(i-y))++ans;
				a[j]=i;
		}
			}
	}cout<<ans<<endl;}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[100005],x,y,i,n;
int main() {
	int ans=0;
	memset(a,-1,sizeof(a));
	cin>>n;
	for(i=0;i<n;++i){
		cin>>x>>y;ans=0;
		if(y==0){
			for(int j=1;j*j<=x;++j){
				if(x%j==0 && j*j!=x){ans+=2;a[j]=i;a[x/j]=i;}
				else if(x%j==0){ans+=1;a[j]=i;}
			}
		}
		else{
			for(int j=1;j*j<=x;++j){
				if(x%j==0 && j*j!=x){
					if(a[j]<(i-y))++ans;
					if(a[x/j]<(i-y))++ans;
					a[j]=i;a[x/j]=i;
				}
				else if(x%j==0){if(a[j]<(i-y))++ans;
				a[j]=i;
		}
			}
	}cout<<ans<<endl;}
	return 0;
}//fuck a2oj


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

const int N = 100001 ;
vector < int > dv[N+7] ;
int yo[N+7] ;
int n , x, y ;

void sieve()
{
    for( int i = 2 ; i < N ; i++ )
        for( int j = i ; j < N ; j += i )
            dv[j].push_back(i) ;
}

int fyo(int x, int y , int p )
{
    int ans = 0 ;
    int r = dv[x].size();
    for( int i = 0 ; i < r ; i++ )
    {
        if(yo[dv[x][i]] < y )ans++ ;
        yo[dv[x][i]] = p ;
    }
    if( y == p ) ans++ ;
    return ans ;
}

int main()
{
    sieve() ;
    cin >> n ;
    for( int i = 1 ; i <= n ; i++ )
    {
        scanf("%d %d", &x, &y ) ;
        printf("%d\n", fyo( x, i-y , i ) ) ;
    }

    return 0 ;
}


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

const int N = 100001 ;
vector < int > dv[N+7] ;
int yo[N+7] ;
int n , x, y ;

void sieve()
{
    for( int i = 2 ; i < N ; i++ )
        for( int j = i ; j < N ; j += i )
            dv[j].push_back(i) ;
}

int fyo(int x, int y , int p )
{
    int ans = 0 ;
    int r = dv[x].size();
    for( int i = 0 ; i < r ; i++ )
    {
        if(yo[dv[x][i]] < y )ans++ ;
        yo[dv[x][i]] = p ;
    }
    return ans ;
}

int main()
{
    sieve() ;
    cin >> n ;
    scanf("%d %d", &x, &y ) ;
    printf("%d\n", 1+fyo( x, 1 , 1 ) ) ;
    for( int i = 2 ; i <= n ; i++ )
    {
        scanf("%d %d", &x, &y ) ;
        printf("%d\n", fyo( x, i-y , i ) ) ;
    }

    return 0 ;
}


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

#define ll long long
#define si(x) scanf("%d",&x)
#define sc(ch) scanf(" %c",&ch);
#define sl(x) scanf("%I64d",&x)
#define pi(x) cout << x <<" "
#define nl cout << '\n'
#define mp make_pair
#define pb push_back
#define f first
#define se second
#define pii pair<int,int>
#define RESET(a) memset(a,-1,sizeof(a))
#define CLEAR(a) memset(a,0,sizeof(a))
#define all(v)   v.begin(),v.end()
#define trv(it,v) for(it=v.begin();it!=v.end();it++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define MIN INT_MIN
#define MAX INT_MAX
#define INF 10e8

int a[100005][2];
map<int, vector<int> > M;
int ct;
void func(int i,int x, int k)
{
    if(M.count(x)){
         auto it = lower_bound(all(M[x]),k);
            if(it==M[x].end())
                ct++;
            }
    else
       ct++;
    M[x].pb(i);
}

int main()
{
    std::ios::sync_with_stdio(false);
    #ifndef ONLINE_JUDGE
        freopen("1.txt", "r", stdin);
        //freopen("out", "w", stdout);
    #endif

    int n;
    cin >> n;
    rep(i,1,n+1)
     cin >> a[i][0] >> a[i][1];

    for(int i=1; i<=n; i++){
        ct=0;
        int x = a[i][0];
        int k = i-a[i][1];
        for(int j=2; j*j<=x; j++){
            if(x%j==0){
                func(i,j,k);
                if(j*j != x)
                    func(i,x/j,k);
            }
        }
        func(i,x,k);
        if(k == i)
            ct++;
        pi(ct);
        nl;
    }

   return 0;
}


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

#define ll long long
#define si(x) scanf("%d",&x)
#define sc(ch) scanf(" %c",&ch);
#define sl(x) scanf("%I64d",&x)
#define pi(x) cout << x <<" "
#define nl cout << '\n'
#define mp make_pair
#define pb push_back
#define f first
#define se second
#define pii pair<int,int>
#define RESET(a) memset(a,-1,sizeof(a))
#define CLEAR(a) memset(a,0,sizeof(a))
#define all(v)   v.begin(),v.end()
#define trv(it,v) for(it=v.begin();it!=v.end();it++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define MIN INT_MIN
#define MAX INT_MAX
#define INF 10e8

int a[100005][2];
map<int, vector<int> > M;
int ct;
void func(int i,int x, int k)
{
    if(M.count(x)){
         auto it = lower_bound(all(M[x]),k);
            if(it==M[x].end())
                ct++;
            }
    else
       ct++;
    M[x].pb(i);
}

int main()
{
    std::ios::sync_with_stdio(false);
    #ifndef ONLINE_JUDGE
        freopen("1.txt", "r", stdin);
        //freopen("out", "w", stdout);
    #endif

    int n;
    cin >> n;
    rep(i,1,n+1)
     cin >> a[i][0] >> a[i][1];

    for(int i=1; i<=n; i++){
        ct=0;
        int x = a[i][0];
        int k = i-a[i][1];
        for(int j=1; j*j<=x; j++){
            if(x%j==0){
                func(i,j,k);
                if(j*j != x)
                    func(i,x/j,k);
            }
        }
        pi(ct);
        nl;
    }

   return 0;
}


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

vector<int> pos(100001, -1);

int main(){
    ios::sync_with_stdio(false); cin.tie(0);
    int t, a, b, r, ans;
    cin>>t;
    for(int i=1 ; i<=t ; ++i){
        cin>>a>>b;
        ans = 0;
        r = sqrt(a);
        for(int j=1 ; j<r ; ++j)
            if(a%j == 0){
                if(i-pos[j]>b)
                    ans++;
                if(i-pos[a/j]>b)
                    ans++;
                pos[j] = i;
                pos[a/j] = i;;
            }
        if(a%r == 0){
            if(i-pos[r]>b)
                ans++;
            if(r*r != a && i-pos[a/r]>b)
                ans++;
            pos[r] = i;
            pos[a/r] = i;
        }
        cout<<ans<<"\n";
    }
}


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

vector<int> pos(100001, -1);

int main(){
    //ios::sync_with_stdio(false); cin.tie(0);
    int t, a, b, r, ans;
    cin>>t;
    for(int i=1 ; i<=t ; ++i){
        cin>>a>>b;
        ans = 0;
        r = sqrt(a);
        for(int j=1 ; j<r ; ++j)
            if(a%j == 0){
                if(i-pos[j]>b)
                    ans++;
                if(i-pos[a/j]>b)
                    ans++;
                pos[j] = i;
                pos[a/j] = i;;
            }
        if(a%r == 0){
            if(i-pos[r]>b)
                ans++;
            if(r*r != a && i-pos[a/r]>b)
                ans++;
            pos[r] = i;
            pos[a/r] = i;
        }
        cout<<ans<<"\n";
    }
}


#pragma comment(linker, "/STACK:1000000000")
#define _CRT_SECURE_NO_WARNINGS
#include <functional>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
#include <ctime>
#include <set>
#include <map>
#include <locale>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#define rep(x, a, b) for(int (x) = (a); (x) < int(b); ++(x))
#define Wait cin.sync(); cin.get();
#define INF 0x3F3F3F3F
#define y1 qwerty
#define EPS 1e-6
using namespace std;
typedef long long                  ll;
typedef pair<long long, long long> pll;
typedef pair<int, int>             pii;
typedef pair<double, int>          pdi;
typedef pair<double, double>       pdd;
typedef pair<string, string>       pss;

//#define FILE
//CODEFORCES

set<int> s[4 * 100001];
int arr[100001];

void build(int v, int tl, int tr){
	if (tl == tr){
		for (int i = 1; i <= sqrt(0.0 + arr[tl]); ++i){
			if (arr[tl] % i == 0){
				s[v].insert(i);
				s[v].insert(arr[tl] / i);
			}
		}
	}
	else{
		int tm = (tl + tr) / 2;
		build(2*v, tl, tm);
		build(2*v+1, tm+1, tr);
		s[v].insert(s[2 * v].begin(), s[2 * v].end());
		s[v].insert(s[2 * v + 1].begin(), s[2 * v + 1].end());
	}
}

set<int> get(int v, int tl, int tr, int l, int r){
	if (l > r) return set<int>();
	if ((tl == l) && (tr == r)) return s[v];
	int tm = (tl + tr) / 2;
	set<int> res, left, right;
	left = get(2 * v, tl, tm, l, min(tm, r));
	right = get(2 * v + 1, tm + 1, tr, max(tm + 1, l), r);
	res.insert(left.begin(), left.end());
	res.insert(right.begin(), right.end());
	return res;
}

vector<int> qe;

int main(){
#ifdef FILE
	freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout);
#endif
	int n;
	int x, y;
	scanf("%d", &n);
	rep(i, 0, n){
		scanf("%d %d", &x, &y);
		arr[i] = x;
		qe.push_back(y);
	}
	build(1, 0, n - 1);
	set<int> gg = get(1, 0, n - 1, 1, 2);
	rep(i, 0, n){
		set<int> gg = get(1, 0, n - 1, i - qe[i], i - 1);
		set<int> have = get(1, 0, n - 1, i, i);
		ll ans = 0;
		for (auto x : have){
			if (gg.find(x) == gg.end()) ++ans;
		}
		printf("%d\n", ans);
	}

#ifdef FILE
	printf("TIME: %.3lf\n", (long double)(clock()) / CLOCKS_PER_SEC);
#endif
	Wait return 0;
}


#pragma comment(linker, "/STACK:1000000000")
#define _CRT_SECURE_NO_WARNINGS
#include <functional>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
#include <ctime>
#include <set>
#include <map>
#include <locale>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#define rep(x, a, b) for(int (x) = (a); (x) < int(b); ++(x))
#define Wait cin.sync(); cin.get();
#define INF 0x3F3F3F3F
#define y1 qwerty
#define EPS 1e-6
using namespace std;
typedef long long                  ll;
typedef pair<long long, long long> pll;
typedef pair<int, int>             pii;
typedef pair<double, int>          pdi;
typedef pair<double, double>       pdd;
typedef pair<string, string>       pss;

//#define FILE
//CODEFORCES

int have[100001];
int n, x, y;

int main(){
#ifdef FILE
	freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout);
#endif
	memset(have, -1, sizeof have);
	scanf("%d", &n);
	rep(i, 0, n){
		scanf("%d %d", &x, &y);
		ll ans = 0;
		for (int j = 1; j <= sqrt(0.0 + x); ++j){
			if (x % j == 0){
				if ((have[j] < i - y)) ++ans;
				have[j] = i;
				if ((have[x / j] < i - y)) ++ans;
				have[x / j] = i;
			}
		}
		printf("%d\n", ans);
	}

#ifdef FILE
	printf("TIME: %.3lf\n", (long double)(clock()) / CLOCKS_PER_SEC);
#endif
	Wait return 0;
}


#pragma comment(linker, "/STACK:1000000000")
#define _CRT_SECURE_NO_WARNINGS
#include <functional>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
#include <ctime>
#include <set>
#include <map>
#include <locale>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#define rep(x, a, b) for(int (x) = (a); (x) < int(b); ++(x))
#define Wait cin.sync(); cin.get();
#define INF 0x3F3F3F3F
#define y1 qwerty
#define EPS 1e-6
using namespace std;
typedef long long                  ll;
typedef pair<long long, long long> pll;
typedef pair<int, int>             pii;
typedef pair<double, int>          pdi;
typedef pair<double, double>       pdd;
typedef pair<string, string>       pss;

//#define FILE
//CODEFORCES

vector< vector<int> > di;
bitset<100000> bs;
vector<int> y;
int xx, yy;

int main(){
#ifdef FILE
	freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout);
#endif
	int n;
	scanf("%d", &n);
	di.resize(n);
	rep(i, 0, n){
		scanf("%d %d", &xx, &yy);
		for (int j = 1; j < sqrt(0.0 + xx); ++j){
			if (xx % j == 0){
				di[i].push_back(j);
				di[i].push_back(xx / j);
			}
		}
		int sq = sqrt(0.0 + xx);
		if (1ll * sq * sq == xx) di[i].push_back(sq);
		y.push_back(yy);
	}
	rep(i, 0, n){
		ll ans = 0;
		bs.reset();
		rep(j, i - y[i], i){
			rep(k, 0, di[j].size()) bs.set(di[j][k], 1);
		}
		rep(k, 0, di[i].size()) if (!bs[di[i][k]]) ++ans;
		printf("%I64d\n", ans);
	}

#ifdef FILE
	printf("TIME: %.3lf\n", (long double)(clock()) / CLOCKS_PER_SEC);
#endif
	Wait return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n;
const int sz=1e5+9;
int x[sz],y[sz];
map<int,int> cm[sz],m[sz];
int ans[sz];

void factorize(int idx){
    if(idx>0) cm[idx]=cm[idx-1];
    for(long long u=1;u*u<=x[idx];u++){
        if(x[idx]%u==0){
            cm[idx][u]++;
            m[idx][u]++;
            m[idx][x[idx]/u]++;
            cm[idx][x[idx]/u]++;
        }
    }
    return;
}

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d %d",&x[i],&y[i]);
        factorize(i);
    }
    for(int i=0;i<n;i++){
        if(!y[i]){
            ans[i]=m[i].size();
            continue;
        }
        for(auto u:m[i]){
            int d=u.first;
            int cnt=u.second;
            int toremove=0;
            if(cm[i-1].find(d)!=cm[i-1].end()){
                if(cm[i-y[i]-1].find(d)!=cm[i-y[i]-1].end()){
                    toremove=cm[i-1][d]-cm[i-y[i]-1][d];
                }else toremove=cm[i-1][d];
            }
            cnt-=toremove;
            if(cnt>0) ans[i]++;
        }
    }
    for(int i=0;i<n;i++) printf("%d\n",ans[i]);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n;
const int sz=1e5+9;
int x,y,lst[sz];
int ans[sz];

void solve(int idx){
    for(long long u=1;u*u<=x;u++){
        if(x%u) continue;
        int d1=u;
        int d2=x/u;
        ans[idx]+=(lst[d1]<idx-y);
        ans[idx]+=((d1!=d2)&&(lst[d2]<idx-y));
        lst[d1]=lst[d2]=idx;
    }
    return;
}

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d %d",&x,&y);
        solve(i);
    }
    for(int i=1;i<=n;i++) printf("%d\n",ans[i]);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n;
const int sz=1e5+9;
int x[sz],y[sz];
map<int,int> cm[sz],m[sz];
int ans[sz];

void factorize(int idx){
    if(idx>0) cm[idx]=cm[idx-1];
    for(long long u=1;u*u<=x[idx];u++){
        if(x[idx]%u==0){
            cm[idx][u]++;
            m[idx][u]++;
            m[idx][x[idx]/u]++;
            cm[idx][x[idx]/u]++;
        }
    }
    return;
}

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d %d",&x[i],&y[i]);
        factorize(i);
    }
    for(int i=0;i<n;i++){
        if(!y[i]){
            ans[i]=m[i].size();
            continue;
        }
        for(auto u:m[i]){
            int d=u.first;
            int cnt=u.second;
            int toremove=0;
            if(cm[i-1].find(d)!=cm[i-1].end()){
                if(i-y[i]-1>0&&cm[i-y[i]-1].find(d)!=cm[i-y[i]-1].end()){
                    toremove=cm[i-1][d]-cm[i-y[i]-1][d];
                }else toremove=cm[i-1][d];
            }
            cnt-=toremove;
            if(cnt>0) ans[i]++;
        }
    }
    for(int i=0;i<n;i++) printf("%d\n",ans[i]);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n;
const int sz=1e5+9;
int x[sz],y[sz];
map<int,int> cm[sz],m[sz];
int ans[sz];

void factorize(int idx){
    if(idx>0) cm[idx]=cm[idx-1];
    for(long long u=1;u*u<=x[idx];u++){
        if(x[idx]%u==0){
            cm[idx][u]++;
            m[idx][u]++;
            m[idx][x[idx]/u]++;
            cm[idx][x[idx]/u]++;
        }
    }
    return;
}

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d %d",&x[i],&y[i]);
        factorize(i);
    }
    for(int i=0;i<n;i++){
        if(!y[i]){
            ans[i]=m[i].size();
            continue;
        }
        for(auto u:m[i]){
            int d=u.first;
            int cnt=u.second;
            int toremove=0;
            if(cm[i-1].find(d)!=cm[i-1].end()){
                if(i-y[i]-1>=0&&cm[i-y[i]-1].find(d)!=cm[i-y[i]-1].end()){
                    toremove=cm[i-1][d]-cm[i-y[i]-1][d];
                }else toremove=cm[i-1][d];
            }
            cnt-=toremove;
            if(cnt>0) ans[i]++;
        }
    }
    for(int i=0;i<n;i++) printf("%d\n",ans[i]);
    return 0;
}


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

int main(){
    int n,x,s,y,c;
    cin>>n;
    vector<int> d(100001, 0);
    for(int i=1;i<=n;i++){
        cin>>x>>y;
        s=sqrt(x);
        c=0;
        for(int j = 1;j <= s; j++){
            if(x%j==0){
                if(d[j]<i-y)c++;
                if(d[x/j]<i-y && j!=x/j)c++;
                d[j]=i;d[x/j]=i;
            }
        }
        cout<<c<<endl;
    }
    return 0;
}


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

int main(){
    int n,x,s,y,c;
    cin>>n;
    vector<int> d(10001, 0);
    for(int i=1;i<=n;i++){
        cin>>x>>y;
        s=sqrt(x);
        c=0;
        for(int j = 1;j <= s; j++){
            if(x%j==0){
                if(d[j]<i-y)c++;
                if(d[x/j]<i-y && j!=x/j)c++;
                d[j]=i;d[x/j]=i;
            }
        }
        cout<<c<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#include <numeric>
#define F first
#define S second
#define all(c) c.begin(), c.end()
#define pb(x) push_back(x)
#ifndef ONLINE_JUDGE
        #define LOG(x) cerr << #x << " is " << x << endl;
#else
        #define LOG(x) void(1)
#endif

#define FORT(i,y,x) for(int i=(int)y;i<(int)x;i++)
#define FOR(i,x) FORT(i,0,x)

typedef long long ll;
typedef unsigned long long ull;

using namespace std;
const ll OO = 1LL<<60;
const long double dOO=(double)INT_MAX;

ll mod=1000000007 ;
long double eps=1e-6;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vector<ll> > vvl;

const int N=1e5 +10;
int p;
int last[N];
int bLast[N];

int add(){

return p++;
}

int Div(int x,int p)
{
    int i,res=0;
    for( i=1;i*i<x;i++)if(x%i==0)
        {

            if(last[i]<p)res++;
            last[i]=add();

            if(last[x/i]<p)res++;
            last[x/i]=add();
        }
    if(i*i==x)
    {
            if(last[i]<p)res++;
            last[i]=add();
    }
    return res;

}

int numStart[N];
int main()
{
    memset(last,-1,sizeof last);
        int n;
        scanf("%d",&n);

        for(int i=0;i<n;i++)
        {
            int x,y;
            scanf("%d%d",&x,&y);
            numStart[i]=p;
            int ans=Div(x,numStart[i-y]);
            printf("%d\n",ans);
        }

}


#include<bits/stdc++.h>

#define F first
#define S second
#define all(c) c.begin(), c.end()
#define pb(x) push_back(x)

#define FORT(i,y,x) for(int i=(int)y;i<(int)x;i++)
#define FOR(i,x) FORT(i,0,x)

typedef long long ll;
typedef unsigned long long ull;

using namespace std;
const ll OO = 1LL<<60;
const long double dOO=(double)INT_MAX;

ll mod=1000000007 ;
long double eps=1e-6;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;

const int N=100000+9;

set<int>t[2*N];
int n;
void add(int p, set<int> &s)
{
    int i=p+n;
    for(t[p+=n]=s ; p>1; p>>=1)t[p>>1].insert(all(t[i]));
}

int query(int l,int r,set<int>&s)
{

    for(l+=n, r+=n; l<r;l>>=1,r>>=1)
    {
        if(l&1)
            {
                for(auto x:t[l])s.erase(x);
                l++;
            }
        if(r&1)
            {
                --r;
                for(auto x:t[r])s.erase(x);
            }
    }
    return s.size();
}

set<int> Div(int x)
{
    set<int>s;
    int i;
//    int res=0;
    for(i=1;i*i<x;i++)
    {
        if(x%i==0)s.insert(i),s.insert(x/i);
    }
    if(x%i==0)s.insert(i);
    return s;
}

int main()
{
//    ios::sync_with_stdio(false);cin.tie(0);
//    freopen("out.txt","w",stdout);

    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        int x,y;
        scanf("%d %d",&x ,&y);
        set<int>s=Div(x);
        add(i,s);
        int ans=query(i-y,i,s);
        printf("%d\n",ans);
//        for(auto x:t[1])printf("%d ",x);
//        printf("\n");
    }

    return 0;
}


#include<bits/stdc++.h>
#include <numeric>
#define F first
#define S second
#define all(c) c.begin(), c.end()
#define pb(x) push_back(x)
#ifndef ONLINE_JUDGE
        #define LOG(x) cerr << #x << " is " << x << endl;
#else
        #define LOG(x) void(1)
#endif

#define FORT(i,y,x) for(int i=(int)y;i<(int)x;i++)
#define FOR(i,x) FORT(i,0,x)

typedef long long ll;
typedef unsigned long long ull;

using namespace std;
const ll OO = 1LL<<60;
const long double dOO=(double)INT_MAX;

ll mod=1000000007 ;
long double eps=1e-6;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vector<ll> > vvl;

const int N=1e5 +10;
int t[2*N*350],p;
int last[N];
int bLast[N];

int add(){

return p++;
}

int Div(int x,int p)
{
    int i,res=0;
    for( i=1;i*i<x;i++)if(x%i==0)
        {

            if(last[i]<p)res++;
            last[i]=add();

            if(last[x/i]<p)res++;
            last[x/i]=add();
        }
    if(i*i==x)
    {
            if(last[i]<p)res++;
            last[i]=add();
    }
    return res;

}

int numStart[N];
int main()
{
    memset(last,-1,sizeof last);
        int n;
        scanf("%d",&n);

        for(int i=0;i<n;i++)
        {
            int x,y;
            scanf("%d%d",&x,&y);
            numStart[i]=p;
            int ans=Div(x,numStart[i-y]);
            printf("%d\n",ans);
        }

}


#include<bits/stdc++.h>

#define F first
#define S second
#define all(c) c.begin(), c.end()
#define pb(x) push_back(x)

#define FORT(i,y,x) for(int i=(int)y;i<(int)x;i++)
#define FOR(i,x) FORT(i,0,x)

typedef long long ll;
typedef unsigned long long ull;

using namespace std;
const ll OO = 1LL<<60;
const long double dOO=(double)INT_MAX;

ll mod=1000000007 ;
long double eps=1e-6;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;

const int N=100000+9;

set<int>t[2*N];
int n;
void add(int p, set<int> &s)
{
    for(t[p+=n]=s ; p>1; p>>=1)t[p>>1].insert(all(t[p]));
}

int query(int l,int r,set<int>&s)
{

    for(l+=n, r+=n; l<r;l>>=1,r>>=1)
    {
        if(l&1)
            {
                for(auto x:t[l])s.erase(x);
                l++;
            }
        if(r&1)
            {
                --r;
                for(auto x:t[r])s.erase(x);
            }
    }
    return s.size();
}

set<int> Div(int x)
{
    set<int>s;
    int i;
//    int res=0;
    for(i=1;i*i<x;i++)
    {
        if(x%i==0)s.insert(i),s.insert(x/i);
    }
    if(x%i==0)s.insert(i);
    return s;
}

int main()
{
//    ios::sync_with_stdio(false);cin.tie(0);
//    freopen("out.txt","w",stdout);

    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        int x,y;
        scanf("%d %d",&x ,&y);
        set<int>s=Div(x);
        add(i,s);
        int ans=query(i-y,i,s);
        printf("%d\n",ans);
//        for(auto x:t[1])printf("%d ",x);
//        printf("\n");
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int maxn = 1e5 + 7;

int n, a[maxn], x, y, ans;

void solve() {
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> x >> y; ans = 0;
		for (int j = 1; j * j <= x; ++j) {
			if (x % j == 0) {
				if (a[j] < i - y) {
					ans++;
				}
				if (x / j != j && a[x / j] < i - y) {
					ans++;
				}
				a[j] = a[x / j] = i;
			}
		}
		cout << ans << endl;
	}
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	solve();
	return 0;
}


#include<bits/stdc++.h>
#define prArr(Arr,n) for(int _=0;_<n;_++)   cout<<(Arr)[_]<<" ";
using namespace std;
const int INF=(int)1e9+10;
const int MOD=(int)1e9+7;
void factorize(int);
set<int> factors;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    map<int,int> pref[n+1];
    for(int i=1; i<=n; i++)
    {
        int tmp,diff,ans=0;
        cin>>tmp>>diff;
        factors.clear();
        factors.insert(1);
        factorize(tmp);
        /*for(auto factor:factors)
            cout<<factor<<" ";
        cout<<"\n";*/
        for(auto factor:factors)
            pref[i][factor]=1;
        for(auto p:pref[i-1])
            pref[i][p.first]+=p.second;
        if(!diff)
        {
            cout<<factors.size()<<"\n";
            continue;
        }
        for(auto factor:factors)
            ans+=!(pref[i-1][factor]-pref[i-1-diff][factor]);
        cout<<ans<<"\n";
    }
    return 0;
}

void factorize(int x)
{
    vector<int> nw;
    int cpyX=x;
    for(int i=2; x!=1&&i*i<=cpyX; i++)
    {
        if(x%i==0)
        {
            for(auto factor:factors)
                nw.push_back(factor*i);
            for(auto btts:nw)
                factors.insert(btts);
            x/=i--;
            nw.clear();
        }
    }
    if(x!=1)
    {
        for(auto factor:factors)
            nw.push_back(factor*x);
        for(auto btts:nw)
            factors.insert(btts);
    }
    return;
}


#include<bits/stdc++.h>
#define prArr(Arr,n) for(int _=0;_<n;_++)   cout<<(Arr)[_]<<" ";
using namespace std;
const int INF=(int)1e9+10;
const int MOD=(int)1e9+7;
void factorize(int);
set<int> factors;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    map<int,int> pref[n+1];
    for(int i=1;i<=n;i++)
    {
        int tmp,diff,ans=0;
        cin>>tmp>>diff;
        factors.clear();
        factors.insert(1);
        factorize(tmp);
        /*for(auto factor:factors)
            cout<<factor<<" ";
        cout<<"\n";*/
        for(auto factor:factors)
            pref[i][factor]=1;
        for(auto p:pref[i-1])
            pref[i][p.first]+=p.second;
        if(!diff)
        {
            cout<<factors.size()<<"\n";
            continue;
        }
        for(auto factor:factors)
            ans+=!(pref[i-1][factor]-pref[i-1-diff][factor]);
        cout<<ans<<"\n";
    }
    return 0;
}

void factorize(int x)
{
    vector<int> nw;
    int cpyX=x;
    for(int i=2;x!=1&&i*i<=cpyX;i++)
    {
        if(x%i==0)
        {
            for(auto factor:factors)
                nw.push_back(factor*i);
            for(auto btts:nw)
                factors.insert(btts);
            x/=i--;
            nw.clear();
        }
    }
    if(x!=1)
        factors.insert(x);
    factors.insert(cpyX);
    return;
}


#include<bits/stdc++.h>
#define prArr(Arr,n) for(int _=0;_<n;_++)   cout<<(Arr)[_]<<" ";
using namespace std;
const int INF=(int)1e9+10;
const int MOD=(int)1e9+7;
void factorize(int);
set<int> factors;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    vector<int> last(100001);
    for(int i=1; i<=n; i++)
    {
        int tmp,diff,ans=0;
        cin>>tmp>>diff;
        factorize(tmp);
        for(auto factor:factors)
            ans+=(last[factor]<i-diff),last[factor]=i;
        cout<<ans<<"\n";
    }
    return 0;
}

void factorize(int x)
{
    factors.clear();
    factors.insert(1);
    vector<int> nw;
    int cpyX=x;
    for(int i=2; x!=1&&i*i<=cpyX; i++)
    {
        if(x%i==0)
        {
            for(auto factor:factors)
                nw.push_back(factor*i);
            for(auto btts:nw)
                factors.insert(btts);
            x/=i--;
            nw.clear();
        }
    }
    if(x!=1)
    {
        for(auto factor:factors)
            nw.push_back(factor*x);
        for(auto btts:nw)
            factors.insert(btts);
    }
    return;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <map>
#include <string>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <set>
#include <vector>
#include <algorithm>
#include <queue>
#include <array>
#include <iomanip>
#include <stack>
#include <bitset>
#include <climits>

using namespace std;

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(a) a.begin(), a.end()

typedef long long li;

template<typename T>
ostream& operator << (ostream& os, vector<T>& a) {
	for (int i = 0; i < a.size(); ++i)
		cout << a[i] << ' ';

	return os;
}

const double EPS = 1e-9;
const double PI = 3.1415926535897;

const int N = 1e5 + 7;

int used[N];

int main() {

#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif

	sync;

	int n;
	cin >> n;

	for (int i = 1; i <= n; ++i) {

		int x, y;
		cin >> x >> y;

		int ans = 0;
		for (int j = 1; j * j <= x; ++j) {
			if (x % j == 0) {
				if (used[j] < i - y)
					ans++;

				int t = x / j;
				if (t != j && used[t] < i - y)
					ans++;

				used[j] = i;
				used[t] = i;
			}
		}

		cout << ans << endl;
	}

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <map>
#include <string>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <set>
#include <vector>
#include <algorithm>
#include <queue>
#include <array>
#include <iomanip>
#include <stack>
#include <bitset>
#include <climits>

using namespace std;

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(a) a.begin(), a.end()

typedef long long li;

template<typename T>
ostream& operator << (ostream& os, vector<T>& a) {
	for (int i = 0; i < a.size(); ++i)
		cout << a[i] << ' ';

	return os;
}

const double EPS = 1e-9;
const double PI = 3.1415926535897;

const int N = 3;

int main() {

#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif

	sync;

	int n;
	cin >> n;

	vector<map<int, int>> s(n + 1);
	for (int i = 1; i <= n; ++i) {
		for (auto it : s[i - 1])
			s[i][it.first] += it.second;

		int x, y;
		cin >> x >> y;

		map<int, int> m = s[i];
		for (auto it : s[i - y - 1]) {
			m[it.first] -= it.second;
		}

		int ans = 0;
		for (int j = 1; j * j <= x; ++j) {
			if (x % j == 0) {
				if (!m.count(j) || m[j] == 0)
					ans++;

				int t = x / j;
				if (t != j) {
					if (!m.count(t) || m[t] == 0)
						ans++;

					s[i][t]++;
				}

				s[i][j]++;
			}
		}

		cout << ans << endl;
		/*cout << x << ' ' << ans << endl << "__" << endl;

		for (auto it : s[i])
			cout << it.first << ' ' << it.second << endl;
		cout << "__________________" << endl;

		for (auto it : m)
			cout << it.first << ' ' << it.second << endl;
		cout << endl;*/
	}

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <map>
#include <string>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <set>
#include <vector>
#include <algorithm>
#include <queue>
#include <array>
#include <iomanip>
#include <stack>
#include <bitset>
#include <climits>

using namespace std;

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(a) a.begin(), a.end()

typedef long long li;

template<typename T>
ostream& operator << (ostream& os, vector<T>& a) {
	for (int i = 0; i < a.size(); ++i)
		cout << a[i] << ' ';

	return os;
}

const double EPS = 1e-9;
const double PI = 3.1415926535897;

const int N = 3;

int main() {

#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif

	sync;

	int n;
	cin >> n;

	vector<map<int, unsigned short int>> s(n + 1);
	for (int i = 1; i <= n; ++i) {
		for (auto it : s[i - 1])
			s[i][it.first] += it.second;

		int x, y;
		cin >> x >> y;

		map<int, unsigned short int> m = s[i];
		for (auto it : s[i - y - 1]) {
			m[it.first] -= it.second;

			if (m[it.first] == 0)
				m.erase(it.first);
		}

		int ans = 0;
		for (unsigned short int j = 1; j * 1ll * j <= x; ++j) {
			if (x % j == 0) {
				if (!m.count(j))
					ans++;

				unsigned short int t = x / j;
				if (t != j) {
					if (!m.count(t))
						ans++;

					s[i][t]++;
				}

				s[i][j]++;
			}
		}

		cout << ans << endl;
		/*cout << x << ' ' << ans << endl << "__" << endl;

		for (auto it : s[i])
			cout << it.first << ' ' << it.second << endl;
		cout << "__________________" << endl;

		for (auto it : m)
			cout << it.first << ' ' << it.second << endl;
		cout << endl;*/
	}

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <map>
#include <string>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <set>
#include <vector>
#include <algorithm>
#include <queue>
#include <array>
#include <iomanip>
#include <stack>
#include <bitset>
#include <climits>

using namespace std;

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(a) a.begin(), a.end()

typedef long long li;

template<typename T>
ostream& operator << (ostream& os, vector<T>& a) {
	for (int i = 0; i < a.size(); ++i)
		cout << a[i] << ' ';

	return os;
}

const double EPS = 1e-9;
const double PI = 3.1415926535897;

const int N = 3;

int main() {

#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif

	sync;

	int n;
	cin >> n;

	vector<map<int, int>> s(n + 1);
	for (int i = 1; i <= n; ++i) {
		for (auto it : s[i - 1])
			s[i][it.first] += it.second;

		int x, y;
		cin >> x >> y;

		map<int, int> m = s[i];
		for (auto it : s[i - y - 1]) {
			m[it.first] -= it.second;

			if (m[it.first] == 0)
				m.erase(it.first);
		}

		int ans = 0;
		for (int j = 1; j * j <= x; ++j) {
			if (x % j == 0) {
				if (!m.count(j))
					ans++;

				int t = x / j;
				if (t != j) {
					if (!m.count(t))
						ans++;

					s[i][t]++;
				}

				s[i][j]++;
			}
		}

		cout << ans << endl;
		/*cout << x << ' ' << ans << endl << "__" << endl;

		for (auto it : s[i])
			cout << it.first << ' ' << it.second << endl;
		cout << "__________________" << endl;

		for (auto it : m)
			cout << it.first << ' ' << it.second << endl;
		cout << endl;*/
	}

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <map>
#include <string>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <set>
#include <vector>
#include <algorithm>
#include <queue>
#include <array>
#include <iomanip>
#include <stack>
#include <bitset>
#include <climits>

using namespace std;

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(a) a.begin(), a.end()

typedef long long li;

template<typename T>
ostream& operator << (ostream& os, vector<T>& a) {
	for (int i = 0; i < a.size(); ++i)
		cout << a[i] << ' ';

	return os;
}

const double EPS = 1e-9;
const double PI = 3.1415926535897;

const int N = 3;

int main() {

#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif

	sync;

	int n;
	cin >> n;

	vector<map<int, int>> s(n + 1);
	for (int i = 1; i <= n; ++i) {
		for (auto it : s[i - 1])
			s[i][it.first] += it.second;

		int x, y;
		cin >> x >> y;

		map<int, int> m = s[i];
		for (auto it : s[i - y - 1]) {
			m[it.first] -= it.second;

			if (m[it.first] == 0)
				m.erase(it.first);
		}

		int ans = 0;
		for (int j = 1; j * j <= x; ++j) {
			if (x % j == 0) {
				if (!m.count(j) || m[j] == 0)
					ans++;

				int t = x / j;
				if (t != j) {
					if (!m.count(t) || m[t] == 0)
						ans++;

					s[i][t]++;
				}

				s[i][j]++;
			}
		}

		cout << ans << endl;
		/*cout << x << ' ' << ans << endl << "__" << endl;

		for (auto it : s[i])
			cout << it.first << ' ' << it.second << endl;
		cout << "__________________" << endl;

		for (auto it : m)
			cout << it.first << ' ' << it.second << endl;
		cout << endl;*/
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int arr[100010] ;

int main()
{
    int n ;
    cin >> n ;
    int x , y ;
    fill(arr,arr+100010,-1);
    for ( int i = 0 ; i < n; i++ )
    {
        cin >> x >> y ;
        int ans = 0 ;
        for ( int j = 1 ; j*j <= x ; j++ )
        {
            if ( !(x%j) )
            {
                if ( arr[j] + y >= i ) ;else ans++ ;
                if ( x / j != j ) if ( arr[x/j] + y >= i ) ; else ans++ ;
                arr[j] = arr[x/j] = i ;
            }
        }
        cout << ans << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int b[100010] ;
int main()
{
    ios_base::sync_with_stdio(0) ;
    cin.tie(0) ;

    int n ;
    cin >> n ;
    int x , y ;
    memset(b,-1,sizeof b) ;
    for ( int j = 0 ; j < n ; j++ )
    {
        int ans = 0 ;
        cin >> x >> y ;
        for ( int i = 1 ; i*i <= x ; i++ )
            if ( x%i== 0 )
            {
                if ( b[i] + y  >= j ) ; else ans++ ;
                if ( x/i != i ) if ( b[x/i] + y  >= j ) ; else  ans++ ;
                b[i] = j ;
                b[x/i] = j ;
            }
        cout << ans << "\n" ;
    }
    return 0;
}


/*
ID: xildar91
PROG: kimbits
LANG: C++11
*/
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
int inf_int=2e9;
ll inf_ll=2e18;
typedef pair<int,int> pii;
#define pb push_back
const double pi=3.1415926535898;
#define dout if(debug) cout
#define fi first
#define se second
#define sp setprecision
#define sz size()
template<typename T,typename T1>
void prin(vector<pair<T,T1> >& a)
{
    for(int i=0;i<a.size();i++)
    {
        cout << a[i].fi<<" "<<a[i].se<<"\n";
    }
}
template<typename T>
void prin(vector<T>& a)
{
    for(int i=0;i<a.size();i++)
    {
        cout << a[i];
        if(i<a.size()-1)
            cout<<" ";
        else
            cout <<"\n";
    }
}
template<typename T>
void prin(set<T>& a)
{
    for(auto it=a.begin();it!=a.end();it++)
    {
        cout << *it<<" ";
    }
}
template<typename T>
void prin_new_line(vector<T>& a)
{
    for(int i=0;i<a.size();i++)
    {
        cout << a[i]<<"\n";
    }
}
template<typename T,typename T1>
void prin_new_line(vector<pair<T,T1> >& a)
{
    for(int i=0;i<a.size();i++)
    {
        cout << a[i].fi<<" "<<a[i].se<<"\n";
    }
}

int sum_vec(vector<int>& a)
{
    int s=0;
    for(int i=0;i<a.size();i++)
    {
        s+=a[i];
    }
    return s;
}
template<typename T>
T max(vector<T>& a)
{
    T ans=a[0];
    for(int i=1;i<a.size();i++)
    {
        ans=max(ans,a[i]);
    }
    return ans;
}
template<typename T>
T min(vector<T>& a)
{
    T ans=a[0];
    for(int i=1;i<a.size();i++)
    {
        ans=min(ans,a[i]);
    }
    return ans;
}
template<typename T>
T min(T a,T b,T c)
{
    return min(a,min(b,c));
}
template<typename T>
T max(T a,T b,T c)
{
    return max(a,max(b,c));
}

double s_triangle(double x1,double y1,double x2,double y2,double x3,double y3)
{
    return abs(((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1))/2);
}
bool overflow(ll a,ll b)
{
    if(a*b/b!=a)
        return true;
    return false;
}
#define x1 gfgs
#define y1 asd
#define rank asdsad
bool debug=0;
const int maxn=2e5+70;
set<int> s[maxn];
void solve()
{
    int n;
    cin >> n;
    for(int i=0;i<n;i++)
    {
        int x,y;
        cin >> x >> y;
        if(y==0)
        {
            int ans=0;
            for(int e=1;e*e<=x;e++)
            {
                if(x%e==0)
                {
                    if(x/e==e)
                    {
                        s[e].insert(i);
                        ans++;
                    }
                    else
                    {
                        s[e].insert(i);
                        s[x/e].insert(i);
                        ans=ans+2;
                    }
                }

            }
            cout << ans<<"\n";
        }
        else
        {
            int ans=0;
            for(int e=1;e*e<=x;e++)
            {
                if(x%e==0)
                {
                    if(x/e==e)
                    {

                        if(s[e].lower_bound(i-y)==s[e].end())
                        {
                           // cout << e <<endl;
                            ans++;
                        }
                        s[e].insert(i);
                    }
                    else
                    {

                        if(s[e].lower_bound(i-y)==s[e].end())
                        {
                            //cout << e <<endl;
                            ans++;
                        }
                        if(s[x/e].lower_bound(i-y)==s[x/e].end())
                        {
                         //   cout << x/e <<endl;
                            ans++;
                        }
                        s[e].insert(i);
                        s[x/e].insert(i);
                    }
                }

            }
            cout << ans<<"\n";
        }
    }

}

#define FILE "kimbits"
int main()
{

      //  freopen("input.txt","r",stdin);
      //  freopen("output.txt","w",stdout);

      //   freopen(FILE".in","r",stdin);
      //  freopen(FILE".out","w",stdout);
       if(!debug)
       {
            ios_base::sync_with_stdio(0);
            cin.tie(0);
            cout.tie(0);
       }
        int t=1;
        while(t--)
            solve();
        return 0;
}


/*
ID: xildar91
PROG: kimbits
LANG: C++11
*/
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
int inf_int=2e9;
ll inf_ll=2e18;
typedef pair<int,int> pii;
#define pb push_back
const double pi=3.1415926535898;
#define dout if(debug) cout
#define fi first
#define se second
#define sp setprecision
#define sz size()
template<typename T,typename T1>
void prin(vector<pair<T,T1> >& a)
{
    for(int i=0;i<a.size();i++)
    {
        cout << a[i].fi<<" "<<a[i].se<<"\n";
    }
}
template<typename T>
void prin(vector<T>& a)
{
    for(int i=0;i<a.size();i++)
    {
        cout << a[i];
        if(i<a.size()-1)
            cout<<" ";
        else
            cout <<"\n";
    }
}
template<typename T>
void prin(set<T>& a)
{
    for(auto it=a.begin();it!=a.end();it++)
    {
        cout << *it<<" ";
    }
}
template<typename T>
void prin_new_line(vector<T>& a)
{
    for(int i=0;i<a.size();i++)
    {
        cout << a[i]<<"\n";
    }
}
template<typename T,typename T1>
void prin_new_line(vector<pair<T,T1> >& a)
{
    for(int i=0;i<a.size();i++)
    {
        cout << a[i].fi<<" "<<a[i].se<<"\n";
    }
}

int sum_vec(vector<int>& a)
{
    int s=0;
    for(int i=0;i<a.size();i++)
    {
        s+=a[i];
    }
    return s;
}
template<typename T>
T max(vector<T>& a)
{
    T ans=a[0];
    for(int i=1;i<a.size();i++)
    {
        ans=max(ans,a[i]);
    }
    return ans;
}
template<typename T>
T min(vector<T>& a)
{
    T ans=a[0];
    for(int i=1;i<a.size();i++)
    {
        ans=min(ans,a[i]);
    }
    return ans;
}
template<typename T>
T min(T a,T b,T c)
{
    return min(a,min(b,c));
}
template<typename T>
T max(T a,T b,T c)
{
    return max(a,max(b,c));
}

double s_triangle(double x1,double y1,double x2,double y2,double x3,double y3)
{
    return abs(((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1))/2);
}
bool overflow(ll a,ll b)
{
    if(a*b/b!=a)
        return true;
    return false;
}
#define x1 gfgs
#define y1 asd
#define rank asdsad
bool debug=0;
const int maxn=2e5+70;
set<int> s[maxn];
void solve()
{
    int n;
    cin >> n;
    for(int i=0;i<n;i++)
    {
        int x,y;
        cin >> x >> y;
        if(y==0)
        {
            int ans=0;
            for(int e=1;e*e<=x;e++)
            {
                if(x%e==0)
                {
                    if(x/e==e)
                    {
                        s[e].insert(i);
                        ans++;
                    }
                    else
                    {
                        s[e].insert(i);
                        s[x/e].insert(i);
                        ans=ans+2;
                    }
                }

            }
            cout << ans<<"\n";
        }
        else
        {
            int ans=0;
            for(int e=1;e*e<=x;e++)
            {
                if(x%e==0)
                {
                    if(x/e==e)
                    {

                        if(s[e].lower_bound(y-1)==s[e].end())
                        {
                            ans++;
                        }
                        s[e].insert(i);
                    }
                    else
                    {

                        if(s[e].lower_bound(y-1)==s[e].end())
                        {
                            ans++;
                        }
                        if(s[x/e].lower_bound(y-1)==s[x/e].end())
                        {
                            ans++;
                        }
                        s[e].insert(i);
                        s[x/e].insert(i);
                    }
                }

            }
            cout << ans<<"\n";
        }
    }

}

#define FILE "kimbits"
int main()
{

      //  freopen("input.txt","r",stdin);
      //  freopen("output.txt","w",stdout);

      //   freopen(FILE".in","r",stdin);
      //  freopen(FILE".out","w",stdout);
       if(!debug)
       {
            ios_base::sync_with_stdio(0);
            cin.tie(0);
            cout.tie(0);
       }
        int t=1;
        while(t--)
            solve();
        return 0;
}


#include<fstream>
#include<algorithm>
#include <iostream>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include <stack>
#include <queue>
#include <vector>
#include <unordered_map>
#include <iterator>
#include <math.h>
#include<cstring>
#include <cmath>
#include <sstream>
#include<cstring>
#include<cstdlib>
#include <set>
#include <cstdio>
#include<map>
#include <cmath>
#include <map>
#define fst first
#define snd second
#define pb push_back
#define fast std::ios_base::sync_with_stdio(false);
#define LL long long
#define endl "\n"
#define lp(i,n) for(int i=0;i<(int)n;i++)
#define all(v)              ((v).begin()), ((v).end())
#define sz(v)               ((int)((v).size()))
#define clr(v, d)           memset(v, d, sizeof(v))
#define rep(i, v)       for(int i=0;i<sz(v);i++)
#define neg(v)       memset(v,-1,sizeof(v))
#define emp(v)       memset(v,0,sizeof(v))
#define lp1(i,n)    for(int i=1;i<=(int)n;i++)
using namespace std;
#define FOR(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<pair<int,int> > vii;
typedef pair<int,int> ii;
#define readfile freopen("input.txt","r",stdin);
#define writefile ("output.txt","w",stdout);
#define PI 3.1415926536
typedef pair<LL,LL> pLL;

LL gcd(LL a, LL b) { if(b==0) return a;   return gcd(b,a%b);  }
LL lcm (LL a, LL b) {   return a*(b/(gcd(a,b)));  }
inline int toInt(string s){int v; istringstream sin(s);sin>>v;return v;}
inline LL toLL(string s){LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
typedef pair<int,ii> entry;

int queries;

unordered_map<int,int> h;
int X,Y;
vvi divsors(100000);

void factor(int x){

	int i =1;
	for(;i*i<x;i++){
		if(x%i==0){
			divsors[x].pb(i);
			divsors[x].pb(x/i);
		}
	}
	if(i*i==x) divsors[x].pb(i);
}

int main(){

	fast
	int mx = 0;
	cin >> queries;
	int idx = 1;
	for(int i=1;i<=100000;i++) factor(i);
	while(queries--){
		cin >> X >> Y;
		int res = 0;
		mx = max(mx,X);
		if(Y==0){
			h[X] = idx++;
			cout << divsors[X].size() << endl;
			continue;
		}
		for(auto F:divsors[X]){

			if(F==1) continue;
			int cnt = 0;
			for(int i=F;i<=mx;i+=F){
				if(h.find(i)!=h.end()){;
					if(h[i]>=(idx-Y)&&h[i]<=idx){
						cnt++;
						break;
					}
				}

			}
			if(cnt==0){

				res++;
			}
		}

		h[X] = idx++;

cout << res << endl;

	}

}


#include<fstream>
#include<algorithm>
#include <iostream>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include <stack>
#include <queue>
#include <vector>
#include <iterator>
#include <math.h>
#include<cstring>
#include <cmath>
#include <sstream>
#include<cstring>
#include<cstdlib>
#include <set>
#include <cstdio>
#include<map>
#include <cmath>
#include <map>
#define fst first
#define snd second
#define pb push_back
#define fast std::ios_base::sync_with_stdio(false);
#define LL long long
#define endl "\n"
#define lp(i,n) for(int i=0;i<(int)n;i++)
#define all(v)              ((v).begin()), ((v).end())
#define sz(v)               ((int)((v).size()))
#define clr(v, d)           memset(v, d, sizeof(v))
#define rep(i, v)       for(int i=0;i<sz(v);i++)
#define neg(v)       memset(v,-1,sizeof(v))
#define emp(v)       memset(v,0,sizeof(v))
#define lp1(i,n)    for(int i=1;i<=(int)n;i++)
using namespace std;
#define FOR(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<pair<int,int> > vii;
typedef pair<int,int> ii;
#define readfile freopen("input.txt","r",stdin);
#define writefile ("output.txt","w",stdout);
#define PI 3.1415926536
typedef pair<LL,LL> pLL;

LL gcd(LL a, LL b) { if(b==0) return a;   return gcd(b,a%b);  }
LL lcm (LL a, LL b) {   return a*(b/(gcd(a,b)));  }
inline int toInt(string s){int v; istringstream sin(s);sin>>v;return v;}
inline LL toLL(string s){LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
typedef pair<int,ii> entry;

int queries;

map<int,int> h;
int X,Y;
vvi divsors(100000);

void factor(int x){

	int i =1;
	for(;i*i<x;i++){
		if(x%i==0){
			divsors[x].pb(i);
			divsors[x].pb(x/i);
		}
	}
	if(i*i==x) divsors[x].pb(i);
}

int main(){

	fast
	int mx = 0;
	cin >> queries;
	int idx = 1;
	for(int i=1;i<=100000;i++) factor(i);
	while(queries--){
		cin >> X >> Y;
		int res = 0;
		mx = max(mx,X);
		if(Y==0){
			h[X] = idx++;
			cout << divsors[X].size() << endl;
			continue;
		}
		for(auto F:divsors[X]){

			if(F==1) continue;
			int cnt = 0;
			for(int i=F;i<=mx;i+=F){
				if(h.find(i)!=h.end()){;
					if(h[i]>=(idx-Y)&&h[i]<=idx){
						cnt++;
						break;
					}
				}

			}
			if(cnt==0){

				res++;
			}
		}

		h[X] = idx++;

cout << res << endl;

	}

}


#include<fstream>
#include<algorithm>
#include <iostream>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include <stack>
#include <queue>
#include <vector>
#include <iterator>
#include <math.h>
#include<cstring>
#include <cmath>
#include <sstream>
#include<cstring>
#include<cstdlib>
#include <set>
#include <cstdio>
#include<map>
#include <cmath>
#include <map>
#define fst first
#define snd second
#define pb push_back
#define fast std::ios_base::sync_with_stdio(false);
#define LL long long
#define endl "\n"
#define lp(i,n) for(int i=0;i<(int)n;i++)
#define all(v)              ((v).begin()), ((v).end())
#define sz(v)               ((int)((v).size()))
#define clr(v, d)           memset(v, d, sizeof(v))
#define rep(i, v)       for(int i=0;i<sz(v);i++)
#define neg(v)       memset(v,-1,sizeof(v))
#define emp(v)       memset(v,0,sizeof(v))
#define lp1(i,n)    for(int i=1;i<=(int)n;i++)
using namespace std;
#define FOR(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<pair<int,int> > vii;
typedef pair<int,int> ii;
#define readfile freopen("input.txt","r",stdin);
#define writefile ("output.txt","w",stdout);
#define PI 3.1415926536
typedef pair<LL,LL> pLL;

LL gcd(LL a, LL b) { if(b==0) return a;   return gcd(b,a%b);  }
LL lcm (LL a, LL b) {   return a*(b/(gcd(a,b)));  }
inline int toInt(string s){int v; istringstream sin(s);sin>>v;return v;}
inline LL toLL(string s){LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
typedef pair<int,ii> entry;

int queries;

map<int,int> h;
int X,Y;
vi divsors;

void factor(int x){

	int i =1;
	for(;i*i<x;i++){
		if(x%i==0){
			divsors.pb(i);
			divsors.pb(x/i);
		}
	}
	if(i*i==x) divsors.pb(i);
}

int main(){

	fast
	int mx = 0;
	cin >> queries;
	int idx = 1;
	while(queries--){
		cin >> X >> Y;
		int res = 0;
		mx = max(mx,X);
		divsors.clear();
		factor(X);
		if(Y==0){
			h[X] = idx++;
			cout << divsors.size() << endl;
			continue;
		}
		for(auto F:divsors){

			if(F==1) continue;
			int cnt = 0;
			for(int i=F;i<=mx;i+=F){
				if(h.find(i)!=h.end()){;
					if(h[i]>=(idx-Y)&&h[i]<=idx){
						cnt++;
						break;
					}
				}

			}
			if(cnt==0){

				res++;
			}
		}

		h[X] = idx++;

cout << res << endl;

	}

}


#include<fstream>
#include<algorithm>
#include <iostream>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include <stack>
#include <queue>
#include <vector>
#include <unordered_map>
#include <iterator>
#include <math.h>
#include<cstring>
#include <cmath>
#include <sstream>
#include<cstring>
#include<cstdlib>
#include <set>
#include <cstdio>
#include<map>
#include <cmath>
#include <map>
#define fst first
#define snd second
#define pb push_back
#define fast std::ios_base::sync_with_stdio(false);
#define LL long long
#define endl "\n"
#define lp(i,n) for(int i=0;i<(int)n;i++)
#define all(v)              ((v).begin()), ((v).end())
#define sz(v)               ((int)((v).size()))
#define clr(v, d)           memset(v, d, sizeof(v))
#define rep(i, v)       for(int i=0;i<sz(v);i++)
#define neg(v)       memset(v,-1,sizeof(v))
#define emp(v)       memset(v,0,sizeof(v))
#define lp1(i,n)    for(int i=1;i<=(int)n;i++)
using namespace std;
#define FOR(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<pair<int,int> > vii;
typedef pair<int,int> ii;
#define readfile freopen("input.txt","r",stdin);
#define writefile ("output.txt","w",stdout);
#define PI 3.1415926536
typedef pair<LL,LL> pLL;

LL gcd(LL a, LL b) { if(b==0) return a;   return gcd(b,a%b);  }
LL lcm (LL a, LL b) {   return a*(b/(gcd(a,b)));  }
inline int toInt(string s){int v; istringstream sin(s);sin>>v;return v;}
inline LL toLL(string s){LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
typedef pair<int,ii> entry;

int queries;

int seen[100000+1];
int main(){

	fast
	int n;
	cin >> queries;
	int idx = 1;
	int ok;
	int ans = 0;
	while(queries--){
		cin >> n >> ok;
		ans = 0;
		int i =1;
		for(;i*i<n;i++){
             if(n%i==0){
            	 if(idx-seen[i]>ok) ans++;
            	 seen[i] = idx;
            	 if(idx-seen[n/i]>ok) ans++;
            	      seen[n/i] = idx;

             }

		}
		if(i*i==n){
			if(idx-seen[i]>ok) ans++;
			seen[i] = idx;

		}
idx++;
cout << ans << endl;
	}

}


#include<fstream>
#include<algorithm>
#include <iostream>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include <stack>
#include <queue>
#include <vector>
#include <iterator>
#include <math.h>
#include<cstring>
#include <cmath>
#include <sstream>
#include<cstring>
#include<cstdlib>
#include <set>
#include <cstdio>
#include<map>
#include <cmath>
#include <map>
#define fst first
#define snd second
#define pb push_back
#define fast std::ios_base::sync_with_stdio(false);
#define LL long long
#define endl "\n"
#define lp(i,n) for(int i=0;i<(int)n;i++)
#define all(v)              ((v).begin()), ((v).end())
#define sz(v)               ((int)((v).size()))
#define clr(v, d)           memset(v, d, sizeof(v))
#define rep(i, v)       for(int i=0;i<sz(v);i++)
#define neg(v)       memset(v,-1,sizeof(v))
#define emp(v)       memset(v,0,sizeof(v))
#define lp1(i,n)    for(int i=1;i<=(int)n;i++)
using namespace std;
#define FOR(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<pair<int,int> > vii;
typedef pair<int,int> ii;
#define readfile freopen("input.txt","r",stdin);
#define writefile ("output.txt","w",stdout);
#define PI 3.1415926536
typedef pair<LL,LL> pLL;

LL gcd(LL a, LL b) { if(b==0) return a;   return gcd(b,a%b);  }
LL lcm (LL a, LL b) {   return a*(b/(gcd(a,b)));  }
inline int toInt(string s){int v; istringstream sin(s);sin>>v;return v;}
inline LL toLL(string s){LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
typedef pair<int,ii> entry;

int queries;

map<int,int> h;
int X,Y;
vi divsors;

void factor(int x){

	int i =1;
	for(;i*i<x;i++){
		if(x%i==0){
			divsors.pb(i);
			divsors.pb(x/i);
		}
	}
	if(i*i==x) divsors.pb(i);
}

int main(){

	fast
	int mx = 0;
	cin >> queries;
	int idx = 1;
	while(queries--){
		cin >> X >> Y;
		int res = 0;
		mx = max(mx,X);
		divsors.clear();
		factor(X);
		if(Y==0){
			h[X] = idx++;
			cout << divsors.size() << endl;
			continue;
		}
		for(auto F:divsors){

			if(F==1) continue;
			int cnt = 0;
			for(int i=F;i<mx;i+=F){
				if(h.find(i)!=h.end()){;
					if(h[i]>=(idx-Y)&&h[i]<=idx){
						cnt++;
						break;
					}
				}

			}
			if(cnt==0){

				res++;
			}
		}

		h[X] = idx++;

cout << res << endl;

	}

}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;

#define M 1000000
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define fill(a,x) memset(a,x,sizeof(a))
#define F first
#define S second
#define FOR(i,a,b) for(ll i = a; i<=b; ++i)
#define NFOR(i,a,b) for(ll i = a; i>=b; --i)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
const ll INF = 1e18;
const ll mod = 1e9+7;
const ll N = 1e5 + 10;
inline ll add(ll x,ll y){
  x += y;
  if(x >= mod) x -= mod;
  return x;
}
inline ll mul(ll x,ll y){
  x = (1LL * x * y) % mod;
  return x;
}

int main()
{
	fast;

	int last[N];
	int n;cin>>n;
	for(int j=1;j<=n;j++){
		int x,y;
		cin>>x>>y;
		int ct = 0;
		for(int i=1;i*i<=x;i++){
			if(x%i==0){
				if(x/i == i){
					if(last[i]<j-y || y==0)
						ct++;
					last[i]=j;
				}
				else{
					if(last[i]<j-y || y==0)ct++;
					if(last[x/i]<j-y || y==0)ct++;
					last[i]=j;
					last[x/i]=j;
				}
			}
		}
		cout << ct << "\n";
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;

#define M 1000000
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define fill(a,x) memset(a,x,sizeof(a))
#define F first
#define S second
#define FOR(i,a,b) for(ll i = a; i<=b; ++i)
#define NFOR(i,a,b) for(ll i = a; i>=b; --i)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
const ll INF = 1e18;
const ll mod = 1e9+7;
const ll N = 1e5 + 10;
inline ll add(ll x,ll y){
  x += y;
  if(x >= mod) x -= mod;
  return x;
}
inline ll mul(ll x,ll y){
  x = (1LL * x * y) % mod;
  return x;
}

int main()
{
	fast;

	int last[N];
	FOR(i,1,1e5)last[i]=-1;
	int n;cin>>n;
	for(int j=1;j<=n;j++){
		int x,y;
		cin>>x>>y;
		int ct = 0;
		for(int i=1;i*i<=x;i++){
			if(x%i==0){
				if(x/i == i){
					if(last[i]<j-y || y==0)
						ct++;
					last[i]=j;
				}
				else{
					if(last[i]<j-y || y==0)ct++;
					if(last[x/i]<j-y || y==0)ct++;
					last[i]=j;
					last[x/i]=j;
				}
			}
		}
		cout << ct << "\n";
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;

#define M 1000000
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define fill(a,x) memset(a,x,sizeof(a))
#define F first
#define S second
#define FOR(i,a,b) for(ll i = a; i<=b; ++i)
#define NFOR(i,a,b) for(ll i = a; i>=b; --i)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
const ll INF = 1e18;
const ll mod = 1e9+7;
const ll N = 1e5 + 10;
inline ll add(ll x,ll y){
  x += y;
  if(x >= mod) x -= mod;
  return x;
}
inline ll mul(ll x,ll y){
  x = (1LL * x * y) % mod;
  return x;
}

int main()
{
	fast;

	int last[N];
	int n;cin>>n;
	for(int j=1;j<=n;j++){
		int x,y;
		cin>>x>>y;
		int ct = 0;
		for(int i=1;i*i<=x;i++){
			if(x%i==0){
				if(x/i == i){
					if(last[i]<j-y)
						ct++;
					last[i]=j;
				}
				else{
					if(last[i]<j-y)ct++;
					if(last[x/i]<j-y)ct++;
					last[i]=j;
					last[x/i]=j;
				}
			}
		}
		cout << ct << "\n";
	}

	return 0;
}


#include <iostream>
#include <cstdio>
using namespace std;

const int MX=100*1000+9;
int last_pos[MX];

int consider(int L, int i, int d)
{
    int result=last_pos[d] < L ? 1 : 0;
    last_pos[d]=i;
    return result;
}

int main()
{
    int n;
    scanf("%d", &n);
    for(int i=1; i<=n; i++)
    {
        int x, y;
        scanf("%d %d", &x, &y);

        int result=0;
        for(int d=1; d*d<=x; d++)
        {
            if(x%d==0)
            {
                result+=consider(i-y, i, d);
                if(d*d!=x) result+=consider(i-y, i, x/d);
            }
        }
        //cout << result << '\n';
        printf("%d\n", result);
    }

    return 0;
}


#include <iostream>
#include <vector>
#include <set>
#include <cassert>
using namespace std;

/*
struct node
{
    set<int> S;
};
*/

typedef set<int> node;

bool contains(const set<int>& S, int val)
{
    return S.find(val) != S.end();
}

struct seg_tree
{
    int n, pow2;
    vector<node> v;

    seg_tree(int _n):n(_n), pow2(1), v(vector<node>())
    {
        while(pow2<n) pow2*=2;

        v.resize(2*pow2);
    }

    bool in_set_internal(int L, int R, int LB, int RB, int ind, int val)
    {
        //cout << "IN SET? INTERNAL: " << L << ' ' << R << ' ' << LB << ' ' << RB << ' ' << ind << ' ' << val << endl;

        if(L > R) return false;
        assert(LB <= L && R<= RB);
        assert(ind < 2*pow2);

        if(LB==L && R == RB)
        {
            return contains(v[ind], val);
        }

        int MB=(LB+RB)/2;
        return  in_set_internal(L,            min(MB, R), LB,   MB, ind*2,     val) ||
                in_set_internal(max(L, MB+1), R,          MB+1, RB, ind*2 + 1, val);
    }

    bool in_set_wrapper(int L, int R, int val)
    {
        return in_set_internal(L, R, 0, pow2-1, 1, val);
    }

    void insert_wrapper(int pos, int val)
    {
        pos+=pow2;
        while(pos > 0)
        {
            v[pos].insert(val);
            pos/=2;
        }
    }
};

/*
node unite(node A, node B)
{
    node R;
    R.insert()
}
*/

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

    seg_tree T(n);

    for(int i=0; i<n; i++)
    {
        int x, y;
        cin >> x >> y;

        int L=i-y, R=i-1;

        int result=0;
        for(int d=1; d*d<=x; d++)
        {
            if(x%d==0)
            {
                //cout << "D: " << d << endl;
                if(!T.in_set_wrapper(L, R, d)) result++;
                T.insert_wrapper(i, d);

                if(d*d!=x)
                {
                    //cout << "D2: " << x/d << endl;

                    if(!T.in_set_wrapper(L, R, x/d)) result++;
                    T.insert_wrapper(i, x/d);
                }
            }
        }

        cout << result << '\n';
        //cout << "------------------" << endl;
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <cassert>
using namespace std;

/*
struct node
{
    set<int> S;
};
*/

typedef set<int> node;

unsigned char contains(const set<int>& S, int val)
{
    return S.find(val) != S.end();
}
const int MX=100009;
int vals[MX];
int cnt;
int ans[MX];

struct seg_tree
{
    int n, pow2;
    vector<node> v;

    seg_tree(int _n):n(_n), pow2(1), v(vector<node>())
    {
        while(pow2<n) pow2*=2;

        v.resize(2*pow2);
    }

    //bool in_set_internal(int L, int R, int LB, int RB, int ind, int val)
    void in_set_internal(int L, int R, int LB, int RB, int ind)
    {
        //cout << "IN SET? INTERNAL: " << L << ' ' << R << ' ' << LB << ' ' << RB << ' ' << ind << endl;
        //if(L > R) return false;
        if(L > R) return;

        assert(LB <= L && R<= RB);
        assert(ind < 2*pow2);

        if(LB==L && R == RB)
        {
            //return contains(v[ind], val);
            for(int i=0; i<cnt; i++) ans[i]|=contains(v[ind], vals[i]);
            return;
        }

        int MB=(LB+RB)/2;
        //return  in_set_internal(L,            min(MB, R), LB,   MB, ind*2,     val) ||
        //        in_set_internal(max(L, MB+1), R,          MB+1, RB, ind*2 + 1, val);

        in_set_internal(L,            min(MB, R), LB,   MB, ind*2);
        in_set_internal(max(L, MB+1), R,          MB+1, RB, ind*2 + 1);
    }

    //bool in_set_wrapper(int L, int R, int val)
    void in_set_wrapper(int L, int R)
    {
        //return in_set_internal(L, R, 0, pow2-1, 1, val);
        //in_set_internal(L, R, 0, pow2-1, 1, vals, cnt, ans);
        for(int i=0; i<cnt; i++) ans[i]=0;
        in_set_internal(L, R, 0, pow2-1, 1);
    }

    //void insert_wrapper(int pos, int val)
    void insert_wrapper(int pos)
    {
        pos+=pow2;
        while(pos > 0)
        {
            v[pos].insert(vals, vals+cnt);
            pos/=2;
        }
    }
};

int main()
{
    int n;
    //cin >> n;
    scanf("%d", &n);

    seg_tree T(n);

    for(int i=0; i<n; i++)
    {
        int x, y;
        //cin >> x >> y;
        scanf("%d %d", &x, &y);

        cnt=0;
        for(int d=1; d*d<=x; d++)
        {
            if(x%d==0)
            {
                vals[cnt++]=d;
                if(d*d!=x) vals[cnt++]=x/d;
            }
        }

        int L=i-y, R=i-1;
        T.in_set_wrapper(L, R);

        int result=0;
        //cout << "DBG ANS: ";
        for(int j=0; j<cnt; j++)
        {
            if(ans[j]==0)
            {
                //cout << vals[j] << ' ';
                result++;
            }
        }
        //cout << endl;
        T.insert_wrapper(i);

        //cout << result << '\n';
        printf("%d\n", result);
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <cassert>
using namespace std;

/*
struct node
{
    set<int> S;
};
*/

typedef set<int> node;

unsigned char contains(const set<int>& S, int val)
{
    return S.find(val) != S.end();
}
const int MX=100009;
int vals[MX];
int cnt;
int ans[MX];

struct seg_tree
{
    int n, pow2;
    vector<node> v;

    seg_tree(int _n):n(_n), pow2(1), v(vector<node>())
    {
        while(pow2<n) pow2*=2;

        v.resize(2*pow2);
    }

    void in_set_internal(int L, int R, int LB, int RB, int ind)
    {
        if(L > R) return;

        assert(LB <= L && R<= RB);
        assert(ind < 2*pow2);

        if(LB==L && R == RB)
        {
            set<int>& curr=v[ind];
            for(int i=0; i<cnt; i++) ans[i]|=contains(curr, vals[i]);
            return;
        }

        int MB=(LB+RB)/2;

        in_set_internal(L,            min(MB, R), LB,   MB, ind*2);
        in_set_internal(max(L, MB+1), R,          MB+1, RB, ind*2 + 1);
    }

    //bool in_set_wrapper(int L, int R, int val)
    void in_set_wrapper(int L, int R)
    {
        for(int i=0; i<cnt; i++) ans[i]=0;
        in_set_internal(L, R, 0, pow2-1, 1);
    }

    //void insert_wrapper(int pos, int val)
    void insert_wrapper(int pos)
    {
        pos+=pow2;
        while(pos > 0)
        {
            v[pos].insert(vals, vals+cnt);
            pos/=2;
        }
    }
};

int main()
{
    int n;
    //cin >> n;
    scanf("%d", &n);

    seg_tree T(n);

    for(int i=0; i<n; i++)
    {
        int x, y;
        scanf("%d %d", &x, &y);

        cnt=0;
        for(int d=1; d*d<=x; d++)
        {
            if(x%d==0)
            {
                vals[cnt++]=d;
                if(d*d!=x) vals[cnt++]=x/d;
            }
        }

        int L=i-y, R=i-1;
        T.in_set_wrapper(L, R);

        int result=0;
        for(int j=0; j<cnt; j++)
        {
            if(ans[j]==0)
            {
                result++;
            }
        }
        T.insert_wrapper(i);

        printf("%d\n", result);
    }

    return 0;
}


#include <iostream>
using namespace std;

const int MX=100*1000+9;
int last_pos[MX];

int consider(int L, int i, int d)
{
    int result=last_pos[d] < L ? 1 : 0;
    last_pos[d]=i;
    return result;
}

int main()
{
    int n;
    cin >> n;
    for(int i=1; i<=n; i++)
    {
        int x, y;
        cin >> x >> y;

        int result=0;
        for(int d=1; d*d<=x; d++)
        {
            if(x%d==0)
            {
                result+=consider(i-y, i, d);
                if(d*d!=x) result+=consider(i-y, i, x/d);
            }
        }
        cout << result << '\n';
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <cassert>
using namespace std;

/*
struct node
{
    set<int> S;
};
*/

typedef set<int> node;

bool contains(const set<int>& S, int val)
{
    return S.find(val) != S.end();
}

struct seg_tree
{
    int n, pow2;
    vector<node> v;

    seg_tree(int _n):n(_n), pow2(1), v(vector<node>())
    {
        while(pow2<n) pow2*=2;

        v.resize(2*pow2);
    }

    bool in_set_internal(int L, int R, int LB, int RB, int ind, int val)
    {
        //cout << "IN SET? INTERNAL: " << L << ' ' << R << ' ' << LB << ' ' << RB << ' ' << ind << ' ' << val << endl;

        if(L > R) return false;
        assert(LB <= L && R<= RB);
        assert(ind < 2*pow2);

        if(LB==L && R == RB)
        {
            return contains(v[ind], val);
        }

        int MB=(LB+RB)/2;
        return  in_set_internal(L,            min(MB, R), LB,   MB, ind*2,     val) ||
                in_set_internal(max(L, MB+1), R,          MB+1, RB, ind*2 + 1, val);
    }

    bool in_set_wrapper(int L, int R, int val)
    {
        return in_set_internal(L, R, 0, pow2-1, 1, val);
    }

    void insert_wrapper(int pos, int val)
    {
        pos+=pow2;
        while(pos > 0)
        {
            v[pos].insert(val);
            pos/=2;
        }
    }
};

int main()
{
    int n;
    //cin >> n;
    scanf("%d", &n);

    seg_tree T(n);

    for(int i=0; i<n; i++)
    {
        int x, y;
        //cin >> x >> y;
        scanf("%d %d", &x, &y);

        int L=i-y, R=i-1;

        int result=0;
        for(int d=1; d*d<=x; d++)
        {
            if(x%d==0)
            {
                if(!T.in_set_wrapper(L, R, d)) result++;
                T.insert_wrapper(i, d);

                if(d*d!=x)
                {
                    if(!T.in_set_wrapper(L, R, x/d)) result++;
                    T.insert_wrapper(i, x/d);
                }
            }
        }

        //cout << result << '\n';
        printf("%d\n", result);
    }

    return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll n;
ll last[100005];
bool check(ll num, ll till)
{
        if(last[num] < till) return true;
        return false;
}
int main()
{
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cin >> n;
        for(ll i=1;i<=n;i++)
        {
                ll x,y;
                ll cnt = 0;
                cin >> x >> y;
                for(ll j =1;j *j <= x;j++)
                {
                        if(x % j == 0)
                        {
                                if(check(j , i - y)) cnt++;
                                if(j*j == x) continue;
                                if(check(x/j , i - y)) cnt++;
                        }
                }
                cout << cnt << "\n";
                for(ll j =1;j *j <= x;j++)
                {
                        if(x % j == 0)
                        {
                                last[j] = i;
                                last[x/j] = i;
                        }
                }
        }
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll n;
ll last[100005];
/*bool check(ll num, ll till)
{
        if(last[num] < till) return true;
        return false;
}
*/
int main()
{
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cin >> n;
        for(ll i=1;i<=n;i++)
        {
                ll x,y;
                ll cnt = 0;
                cin >> x >> y;
                for(ll j =1;j *j <= x;j++)
                {
                        if(x % j == 0)
                        {
                                if(last[j] < i - y) cnt++;
                                if(j*j == x) continue;
                                if(last[x/j] < i - y) cnt++;
                        }
                }
                cout << cnt << "\n";
                for(ll j =1;j *j <= x;j++)
                {
                        if(x % j == 0)
                        {
                                last[j] = i;
                                last[x/j] = i;
                        }
                }
        }
}


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

int n;
const int maxn=100010;
int prime[maxn];
struct node
{
    int x,y;
}qq[maxn];
vector<int> jj[maxn];
void getprime()
{
    memset(prime,0,sizeof(prime));
    for(int i=2;i<=maxn;i++)
    {
        if(!prime[i])
            prime[++prime[0]]=i;
        for(int j=1;j<=prime[0]&&prime[j]<=maxn/i;j++)
        {
            prime[prime[j]*i]=1;
            if(i%prime[j]==0)
                break;
        }
    }
}
int dp[maxn];
int getfactors2(int x,int p)
{

    int tmp=x;
 for(int j8=0;j8<jj[x].size();j8++)
    {
        int j=jj[x][j8];
         dp[j]=p;

    }

}

void init()
{

        for(int i=1;i<=maxn;i++)
    {
        for(int j=i;j<=maxn;j+=i)
        {
            jj[j].push_back(i);
        }
    }

}
int main()
{
    init();
    memset(dp,0,sizeof(dp));
    cin>>n;
for(int i=1;i<=n;i++)
{
   scanf("%d%d",&qq[i].x,&qq[i].y);

}

for(int i=1;i<=n;i++)
{
    int ans=0;

       for(int j8=0;j8<jj[qq[i].x].size();j8++)
    {
        int j=jj[qq[i].x][j8];
          if(i-dp[j]>qq[i].y)
            ans++;

    }

cout<<ans<<endl;
getfactors2(qq[i].x,i);
}

    return 0;
}


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

int n;
const int maxn=100010;
int prime[maxn];
struct node
{
    int x,y;
}qq[maxn];
vector<int> jj;
void getprime()
{
    memset(prime,0,sizeof(prime));
    for(int i=2;i<=maxn;i++)
    {
        if(!prime[i])
            prime[++prime[0]]=i;
        for(int j=1;j<=prime[0]&&prime[j]<=maxn/i;j++)
        {
            prime[prime[j]*i]=1;
            if(i%prime[j]==0)
                break;
        }
    }
}
int dp[maxn];
int getfactors2(int x,int p)
{

    int tmp=x;
   dp[1]=p;
    for(int i=2;i<=sqrt(x);i++)
    {
    if(tmp%i==0)
     {
         dp[i]=p;
         dp[tmp/i]=p;
     }
    }
    dp[tmp]=p;

}

int main()
{
    memset(dp,0,sizeof(dp));
    cin>>n;
for(int i=1;i<=n;i++)
{
   scanf("%d%d",&qq[i].x,&qq[i].y);

}

for(int i=1;i<=n;i++)
{
    int ans=0;
    if(i-dp[1]>qq[i].y)
        ans++;
      //  cout<<ans<<endl;
    if(i-dp[qq[i].x]>qq[i].y)
        ans++;
        //cout<<ans<<endl;
         for(int j=2;j<=sqrt(qq[i].x+0.5);j++)
    {
    if(qq[i].x%j==0)
      {
          int tt1=j;
          int tt2=qq[i].x/j;
          if(i-dp[tt1]>qq[i].y)
            ans++;
              if(i-dp[tt2]>qq[i].y&&tt1!=tt2)
            ans++;

      }
    }

cout<<ans<<endl;
getfactors2(qq[i].x,i);
}

    return 0;
}


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

int n;
const int maxn=100010;
int prime[maxn];
struct node
{
    int x,y;
}qq[maxn];
vector<int> jj;
void getprime()
{
    memset(prime,0,sizeof(prime));
    for(int i=2;i<=maxn;i++)
    {
        if(!prime[i])
            prime[++prime[0]]=i;
        for(int j=1;j<=prime[0]&&prime[j]<=maxn/i;j++)
        {
            prime[prime[j]*i]=1;
            if(i%prime[j]==0)
                break;
        }
    }
}
int dp[maxn];
int getfactors2(int x,int p)
{

    int tmp=x;
   dp[1]=p;
    for(int i=2;i<=sqrt(x);i++)
    {
    if(tmp%i==0)
      dp[i]=p;
    }
    dp[tmp]=p;

}

int main()
{
    memset(dp,0,sizeof(dp));
    cin>>n;
for(int i=1;i<=n;i++)
{
   scanf("%d%d",&qq[i].x,&qq[i].y);

}

for(int i=1;i<=n;i++)
{
    int ans=0;
    if(i-dp[1]>qq[i].y)
        ans++;
      //  cout<<ans<<endl;
    if(i-dp[qq[i].x]>qq[i].y)
        ans++;
        //cout<<ans<<endl;
         for(int j=2;j<=sqrt(qq[i].x+0.5);j++)
    {
    if(qq[i].x%j==0)
      {
          int tt1=j;
          int tt2=qq[i].x/j;
          if(i-dp[tt1]>qq[i].y)
            ans++;
              if(i-dp[tt2]>qq[i].y&&tt1!=tt2)
            ans++;

      }
    }

cout<<ans<<endl;
getfactors2(qq[i].x,i);
}

    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <cstdio>
#include <cstring>
#include <string>
#include <map>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T— > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9 + 7;
const int SIZE = 1e6+ 10;

int main()
{

    LL n;
    cin >> n;
    int mass[SIZE] = { 0 }, mass1[SIZE] = { 0 };
    REP(i, n)cin >> mass[i]>>mass1[i];

    int last[SIZE] = { 0 };

    REP(i, SIZE)last[i] = -1;

        REP(i, n)
        {
            int res=0;
            for (int u = 1; u*u < mass[i]; u++)
            {
                if (!(mass[i] % u))
                {
                    if (i - last[u] > mass1[i])
                        res++;
                    last[u] = i;

                    if (i - last[mass[i]/u] > mass1[i])
                        res++;
                    last[mass[i]/u] = i;
                }
            }
            if ((int)sqrt(mass[i])*(int)sqrt(mass[i])==mass[i])
            {
                if (i - last[(int)sqrt(mass[i])] >= mass1[i])
                    res++;
                last[(int)sqrt(mass[i])] =i;
            }
            cout << res << endl;

        }

    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <cstdio>
#include <cstring>
#include <string>
#include <map>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T— > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9 + 7;
const int SIZE = 1e6+ 10;

int main()
{

    LL n;
    cin >> n;
    int mass[SIZE] = { 0 }, mass1[SIZE] = { 0 };
    REP(i, n)cin >> mass[i]>>mass1[i];

    int last[SIZE] = { 0 };

    REP(i, SIZE)last[i] = -1;

        REP(i, n)
        {
            int res=0;
            for (int u = 1; u*u < mass[i]; u++)
            {
                if (!(mass[i] % u))
                {
                    if (i - last[u] > mass1[i])
                        res++;
                    last[u] = i;

                    if (i - last[mass[i]/u] > mass1[i])
                        res++;
                    last[mass[i]/u] = i;
                }
            }
            if ((int)sqrt(mass[i])*(int)sqrt(mass[i])==mass[i])
            {
                if (i - last[(int)sqrt(mass[i])] >= mass1[i])
                    res++;
                last[(int)sqrt(mass1[i])] =i;
            }
            cout << res << endl;

        }

    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <cstdio>
#include <cstring>
#include <string>
#include <map>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T— > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9 + 7;
const int SIZE = 1e2+ 10;

int main()
{

    LL n;
    cin >> n;
    int mass[SIZE] = { 0 }, mass1[SIZE] = { 0 };
    REP(i, n)cin >> mass[i]>>mass1[i];

    int last[SIZE] = { 0 };

    REP(i, SIZE)last[i] = -1;

        REP(i, n)
        {
            int res=0;
            for (int u = 1; u*u < mass[i]; u++)
            {
                if (!(mass[i] % u))
                {
                    if (i - last[u] > mass1[i])
                        res++;
                    last[u] = i;

                    if (i - last[mass[i]/u] > mass1[i])
                        res++;
                    last[mass[i]/u] = i;
                }
            }
            if ((int)sqrt(mass[i])*(int)sqrt(mass[i])==mass[i])
            {
                if (i - last[(int)sqrt(mass[i])] >= mass1[i])
                    res++;
                last[(int)sqrt(mass[i])] =i;
            }
            cout << res << endl;

        }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define DEBUG_ON 1

#define INF 0x3f3f3f3f
#define NSYNC ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=a; i<(b); ++i)
#define FOR0(i,b) for(int i=0; i<(b); ++i)
#define TRAV(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define RTRAV(it,c) for(__typeof((c).rbegin()) it=(c).rbegin(); it!=(c).rend(); ++it)
#define DBG(x) if(DEBUG_ON) cout << #x << " == " << x << endl
#define DBGP(x) if(DEBUG_ON) cout << "(" << (x).first << ", " << (x).second << ")" << endl
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define R(x) scanf(" %d",&(x))
#define RR(x,y) scanf(" %d %d",&(x), &(y))
#define RRR(x,y,z) scanf(" %d %d %d",&(x), &(y),&(z))
#define CLR(v) memset(v, 0, sizeof(v))
#define SET(v) memset(v, -1, sizeof(v))

typedef long long ll;
typedef int int_type;
typedef pair<int_type, int_type> pii;
typedef vector<int_type> vi;
typedef vector<vi> vii;

const int MAXN = 100010;
vi v[MAXN];
int N = 100000;
int seq[MAXN];
int yy[MAXN];
vi idxs[MAXN];

int main() {
	FOR(i,1,N+1) {
		int x = i;
		while(x<=N) {
			v[x].pb(i);
			x += i;
		}
	}
	int q;
	R(q);
	FOR0(i,q) {
		RR(seq[i], yy[i]);
		idxs[seq[i]].pb(i);
	}

	// FOR(i,1,N+1) {
	// 	if(idxs[i].size()) {
	// 		cout << i << ":";
	// 		TRAV(it, idxs[i]) cout << " " << *it;
	// 		cout << endl;
	// 	}
	// }
	// cout << endl;

	FOR0(i,q) {
		int x,y;
		x = seq[i];
		y = yy[i];
		int ans = 0;
		// DBG(x);
		TRAV(it,v[x]) {
			bool ok = true;
			int aux = *it;
			int p0 = i - y;
			// DBG(aux);
			// DBG(y);
			// DBG(p0);
			// DBG(*it);
			while(aux<=N) {
				auto it2 = lower_bound(idxs[aux].begin(), idxs[aux].end(), p0);
				if(it2 !=idxs[aux].end() && *it2 < i) {
					// if(i==1) {
						// cout << "achei " << *it2 << " para " << *it << endl;
					// }
					ok = false;
					break;
				}
				aux += *it;
			}
			if(ok) {
				// cout << *it << " ";
				++ans;
			}
		}
		printf("%d\n",ans);
		// cout << endl;
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define DEBUG_ON 1

#define INF 0x3f3f3f3f
#define NSYNC ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=a; i<(b); ++i)
#define FOR0(i,b) for(int i=0; i<(b); ++i)
#define TRAV(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define RTRAV(it,c) for(__typeof((c).rbegin()) it=(c).rbegin(); it!=(c).rend(); ++it)
#define DBG(x) if(DEBUG_ON) cout << #x << " == " << x << endl
#define DBGP(x) if(DEBUG_ON) cout << "(" << (x).first << ", " << (x).second << ")" << endl
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define R(x) scanf(" %d",&(x))
#define RR(x,y) scanf(" %d %d",&(x), &(y))
#define RRR(x,y,z) scanf(" %d %d %d",&(x), &(y),&(z))
#define CLR(v) memset(v, 0, sizeof(v))
#define SET(v) memset(v, -1, sizeof(v))

typedef long long ll;
typedef int int_type;
typedef pair<int_type, int_type> pii;
typedef vector<int_type> vi;
typedef vector<vi> vii;

const int MAXN = 100010;
vi v[MAXN];
int N = 100000;
int seq[MAXN];
int yy[MAXN];
vi idxs[MAXN];

vi divs[MAXN];

int main() {
	int q;
	R(q);
	FOR0(i,q) {
		RR(seq[i], yy[i]);
		idxs[seq[i]].pb(i);
	}
	FOR(i,1,N+1) {
		int x = i;
		while(x<=N) {
			TRAV(it, idxs[x]) divs[i].pb(*it);
			v[x].pb(i);
			x += i;
		}
		if(divs[i].size()) {
			sort(divs[i].begin(), divs[i].end());
			// cout << i << ":";
			// TRAV(it,divs[i]) cout << " " << *it;
			// cout << endl;
		}
	}

	FOR0(i,q) {
		int x,y;
		x = seq[i];
		y = yy[i];
		int ans = 0;
		TRAV(it,v[x]) {
			bool ok = true;
			int aux = *it;
			int p0 = i - y;
			while(aux<=N) {
				auto it2 = lower_bound(divs[aux].begin(), divs[aux].end(), p0);
				if(it2 !=idxs[aux].end() && *it2 < i) {
					ok = false;
					break;
				}
				break;
				// aux += *it;
			}
			if(ok) {
				// cout << " " << *it;
				++ans;
			}
		}
		// cout << endl;
		// if(y) --ans;
		printf("%d\n",ans);
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;

vector<int> divs[N + 1];
int last_seen[N + 1];
int answer[N + 1];

struct Query
{
    int x, y, idx;
    bool operator < (const Query q) const
    {
        return idx - y < q.idx - q.y;
    }
} queries[N + 1];

int main()
{
    // freopen("input.txt", "r", stdin);

    for (int i = 1; i <= N; i++)
    {
        for (int j = 1; j * j <= i; j++)
        {
            if (i % j == 0)
            {
                divs[i].push_back(j);

                if (j * j != i)
                    divs[i].push_back(i / j);
            }
        }
        //sort(divs[i].begin(), divs[i].end());
    }

    priority_queue<Query> q;

    int n;
    scanf("%d",&n);

    for (int i = 1; i <= n; i++)
    {
        scanf("%d%d",&(queries[i].x),&(queries[i].y));

        queries[i].idx = i;
    }

    for (int i = n; i >= 1; i--)
    {
        q.push(queries[i]);

        for (int div: divs[queries[i].x])
            last_seen[div] = i;

        while (!q.empty() && q.top().idx - q.top().y == i)
        {
            Query query = q.top();
            q.pop();

            answer[query.idx] = divs[query.x].size();

            for (int div: divs[query.x])
                if (last_seen[div] < query.idx)
                    --answer[query.idx];
        }
    }

    for (int i = 1; i <= n; i++)
        printf("%d\n",answer[i]);

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;

vector<int> divs[N + 1];
int last_seen[N + 1];
int answer[N + 1];

struct Query
{
    int x, y, idx;
    bool operator < (const Query q) const
    {
        return idx - y < q.idx - q.y;
    }
} queries[N + 1];

int main()
{
    // freopen("input.txt", "r", stdin);

    for (int i = 1; i <= N; i++)
    {
        for (int j = 1; j * j <= i; j++)
        {
            if (i % j == 0)
            {
                divs[i].push_back(j);

                if (j * j != i)
                    divs[i].push_back(i / j);
            }
        }
        sort(divs[i].begin(), divs[i].end());
    }

    priority_queue<Query> q;

    int n;
    cin >> n;

    for (int i = 1; i <= n; i++)
    {
        cin >> queries[i].x >> queries[i].y;

        queries[i].idx = i;
    }

    for (int i = n; i >= 1; i--)
    {
        q.push(queries[i]);

        for (int div: divs[queries[i].x])
            last_seen[div] = i;

        while (!q.empty() && q.top().idx - q.top().y == i)
        {
            Query query = q.top();
            q.pop();

            answer[query.idx] = divs[query.x].size();

            for (int div: divs[query.x])
                if (last_seen[div] < query.idx)
                    --answer[query.idx];
        }
    }

    for (int i = 1; i <= n; i++)
        cout << answer[i] << endl;

    return 0;
}


#include <bits/stdc++.h>

#define ff first
#define ss second
#define mp make_pair
#define MOD (100000000)
#define oo (1000000000000000000)

using namespace std;

int last[100005];

int main(){

	memset(last, -1, sizeof last);

	int n, x, y;

	scanf("%d", &n);

	for(int i = 0; i < n; i++){
		scanf("%d %d", &x, &y);

		int id = i - y;
		int ans = 0;
		for(int d = 1; d*d <= x; d++){
			if(x % d == 0){
				if(last[d] < id) ans++;
				last[d] = i;
				if(last[x/d] < id) ans++;
				last[x/d] = i;
			}
		}
		printf("%d\n", ans);
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int last[100005];

int main(){

	memset(last, -1, sizeof last);

	int n, x, y;

	scanf("%d", &n);

	for(int i = 0; i < n; i++){
		scanf("%d %d", &x, &y);

		int id = i - y;
		int ans = 0;
		for(int d = 1; d*d <= x; d++){
			if(x % d == 0){
				if(last[d] < id) ans++;
				last[d] = i;
				if(last[x/d] < id) ans++;
				last[x/d] = i;
			}
		}
		printf("%d\n", ans);
	}

	return 0;
}


#define ll long long

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

vector<int>DIV(ll n)
{
    vector<int>vc;
    for(int i = 1 ; i*i <= n ; i++)
    {
        if(n%i==0)
        {
            vc.push_back(i);
            if(n/i!=i)vc.push_back(n/i);
        }
    }
    sort(vc.begin() , vc.end());
    return vc;
}
const int N=1E6;
int arr[N];
int main() {

    int n ;
    cin >> n ;
    vector<pair<int,int>>vc;
    memset(arr,-1,sizeof(arr));
    for(int i = 0 ; i < n ; i++)
    {
        ll x , y ;
        cin >> x >> y ;
        vector<int>ans = DIV(x);
       // for(auto x : ans)cout << x <<" ";
        ll cnt = 0;
        for(auto x : ans)
        {
            if(arr[x] < i  - y   )
            {
                cnt++;
            }
            arr[x]=i;

        }
        cout <<cnt << endl;
        ans.clear();

    }

}


# include <iostream>
# include <string>
# include <vector>
# include <stdio.h>
# include <map>
using namespace std;
int a[1000000];
int main()
{
    int n;
    cin>>n;
    for (int i=1;i<=n;i++)
    {
        int y,x,j;
        cin>>x>>y;
        int s=i-y;
        int num=0;
        for (j=1;j*j<x;j++)
        {
            if (x%j==0)
            {
                int x1=x/j;
                int x2=j;
                if (a[x1]<s)
                    num++;
                if (a[x2]<s)
                    num++;
                a[x1]=i,a[x2]=i;
            }
        }
        if (j*j==x)
        {
            if (a[j]<s)
                num++;
            a[j]=i;
        }
        cout<<num<<endl;
    }
}