#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
int F[MAXN] = {0};
int main() {
  int N, x, y;
  cin >> N;
  for (int I = 1; I <= N; I++) {
    cin >> x >> y;
    int ans = 0;
    for (int i = 1; i <= sqrt(x) + 1; i++) {
      if (x % i) continue;
      if (F[i] + y < I) ans++;
      F[i] = I;
      int j = x / i;
      if (j == i) continue;
      if (F[j] + y < I) ans++;
      F[j] = I;
    }
    cout << ans << endl;
  }
}
