import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.
lang.
Math.
*; import static java.
util.
Arrays.
*;
public class B{
Scanner sc
=new Scanner
(System.
in);
int INF=1<<28;
double EPS=1e-9;
int n;
int[] xs, ys, p;
void run(){
n=sc.nextInt();
xs=new int[n];
ys=new int[n];
for(int i=0; i<n; i++){
xs[i]=sc.nextInt();
ys[i]=sc.nextInt();
}
solve();
}
int check(int k, int i, int y){
int ret=0;
if(p[k]<i-y){
ret=1;
}
p[k]=i;
return ret;
}
void solve(){
p=new int[100001];
fill(p, -1);
for(int i=0; i<n; i++){
int ans=0;
for(int k=1; k*k<=xs[i]; k++){
if(xs[i]%k!=0){
continue;
}
ans+=check(k, i, ys[i]);
if(xs[i]/k!=k){
ans+=check(xs[i]/k, i, ys[i]);
}
}
println(ans+"");
}
}
}
}
}
public static void main
(String[] args
){ new B().run();
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLm1hdGguKjsKaW1wb3J0IGphdmEuaW8uKjsKCmltcG9ydCBzdGF0aWMgamF2YS5sYW5nLk1hdGguKjsKaW1wb3J0IHN0YXRpYyBqYXZhLnV0aWwuQXJyYXlzLio7CgpwdWJsaWMgY2xhc3MgQnsKCVNjYW5uZXIgc2M9bmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKCglpbnQgSU5GPTE8PDI4OwoJZG91YmxlIEVQUz0xZS05OwoKCWludCBuOwoJaW50W10geHMsIHlzLCBwOwoKCXZvaWQgcnVuKCl7CgkJbj1zYy5uZXh0SW50KCk7CgkJeHM9bmV3IGludFtuXTsKCQl5cz1uZXcgaW50W25dOwoJCWZvcihpbnQgaT0wOyBpPG47IGkrKyl7CgkJCXhzW2ldPXNjLm5leHRJbnQoKTsKCQkJeXNbaV09c2MubmV4dEludCgpOwoJCX0KCQlzb2x2ZSgpOwoJfQoKCWludCBjaGVjayhpbnQgaywgaW50IGksIGludCB5KXsKCQlpbnQ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