#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
void Compute(long long int n) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  map<long long int, long long int> mp;
  long long int x, y;
  cin >> x >> y;
  long long int cnt = 0;
  for (long long int j = 1; j * j <= x; j++) {
    if ((x % j) == 0) {
      cnt++;
      mp[j] = 1;
      if (j != (x / j)) {
        cnt++;
        mp[x / j] = 1;
      }
    }
  }
  cout << cnt << "\n";
  for (long long int i = 1; i < n; i++) {
    long long int cnt = 0;
    long long int x, y;
    cin >> x >> y;
    for (long long int j = 1; j * j <= x; j++) {
      if ((x % j) == 0) {
        if ((mp[j] < (i - y + 1)) or (mp[j] == 0)) cnt++;
        if (j != (x / j)) {
          if ((mp[x / j] < (i - y + 1)) or (mp[x / j] == 0)) cnt++;
        }
      }
    }
    for (long long int j = 1; (j * j) <= x; j++) {
      if ((x % j) == 0) {
        mp[j] = i + 1;
        mp[x / j] = i + 1;
      }
    }
    cout << cnt << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  Compute(n);
}
