#include <bits/stdc++.h>
using namespace std;
const int limN = 1e5 + 5;
const int limK = 205;
int n;
int arr[limN];
int calcStepsMemo[limN][limK];
int calcSteps(int pos, int k) {
  if (pos > n) return 0;
  if (calcStepsMemo[pos][k]) return calcStepsMemo[pos][k];
  return calcStepsMemo[pos][k] = calcSteps(pos + k + arr[pos], k) + 1;
}
int main() {
  int q;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &arr[i]);
  for (scanf("%d", &q); q; q--) {
    int p, k, a = 0;
    scanf("%d%d", &p, &k);
    if (k >= limK)
      for (; p <= n; a++, p += arr[p] + k)
        ;
    else
      a = calcSteps(p, k);
    printf("%d\n", a);
  }
  return 0;
}
