#include <bits/stdc++.h>
using namespace std;
int n, q, sqrn, a[100010], f[100010][400];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sqrn = sqrt(n);
  for (int i = n; i; i--)
    for (int j = 1; j <= sqrn; j++) {
      if (i + a[i] + j > n)
        f[i][j] = 1;
      else
        f[i][j] = f[i + a[i] + j][j] + 1;
    }
  scanf("%d", &q);
  for (int i = 1; i <= q; i++) {
    int p, k;
    scanf("%d%d", &p, &k);
    if (k <= sqrn)
      printf("%d\n", f[p][k]);
    else {
      a[0] = 0;
      while (p <= n) {
        a[0]++;
        p += a[p] + k;
      }
      printf("%d\n", a[0]);
    }
  }
  return 0;
}
