#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int S = 500;
int n, a[N], od[N][S];
void solve() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int j = 1; j < S; ++j) {
    for (int i = n; i >= 1; --i) {
      int gdz = i + a[i] + j;
      if (gdz > n)
        od[i][j] = 1;
      else
        od[i][j] = 1 + od[gdz][j];
    }
  }
  int q;
  scanf("%d", &q);
  for (int i = 1; i <= q; ++i) {
    int p, k;
    scanf("%d%d", &p, &k);
    if (k >= S) {
      int ile = 0;
      while (p <= n) {
        ile++;
        p = p + a[p] + k;
      }
      printf("%d\n", ile);
    } else
      printf("%d\n", od[p][k]);
  }
}
int main() {
  solve();
  return 0;
}
