#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 10;
int n, q, a[maxN], p[maxN], k[maxN], f[maxN][400];
void build() {
  int sq = sqrt(n);
  for (int i = n; i >= 1; i--)
    for (int j = 1; j <= sq; j++) {
      if (i + a[i] + j > n)
        f[i][j] = 1;
      else
        f[i][j] = f[i + a[i] + j][j] + 1;
    }
}
int solve(int p, int k) {
  int cnt = 0;
  while (p <= n) {
    p = p + a[p] + k;
    cnt++;
  }
  return cnt;
}
void result() {
  int sq = sqrt(n);
  for (int i = 1; i <= q; i++) {
    if (k[i] > sq) {
      int res = solve(p[i], k[i]);
      cout << res << endl;
    } else
      cout << f[p[i]][k[i]] << endl;
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  cin >> q;
  for (int i = 1; i <= q; i++) cin >> p[i] >> k[i];
  build();
  result();
  return 0;
}
