#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  int b;
  int c;
  int d;
  int e;
  int f;
  cin >> a;
  int aa[a];
  int i = sqrt(a);
  int ab[a + 1][i + 1];
  for (b = 0; b < a; ++b) {
    cin >> aa[b];
  }
  for (b = a - 1; b <= a; ++b) {
    for (c = 1; c <= sqrt(a); ++c) ab[b][c] = 1;
  }
  for (c = 1; c <= sqrt(a); ++c) {
    for (b = a - 2; b > 0; --b) {
      if (b + aa[b - 1] + c > a)
        ab[b][c] = 1;
      else
        ab[b][c] = ab[b + aa[b - 1] + c][c] + 1;
    }
  }
  cin >> d;
  pair<int, int> ac[d];
  for (e = 0; e < d; ++e) {
    cin >> ac[e].first;
    cin >> ac[e].second;
  }
  int g;
  int h;
  for (g = 0; g < d; ++g) {
    e = ac[g].first;
    f = ac[g].second;
    if (f < sqrt(a))
      cout << ab[e][f] << endl;
    else {
      for (h = 0; e <= a; ++h) e = e + aa[e - 1] + f;
      cout << h << endl;
    }
  }
  return 0;
}
