#include <bits/stdc++.h>
using namespace std;
const int MX = 1e5 + 5;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
int A[MX];
int n, m, nowk;
int dp[MX], vtim[MX], vsz;
int ans[MX];
struct Ques {
  int p, k, id;
  bool operator<(const Ques &P) const { return k < P.k; }
} Q[MX];
int DP(int p) {
  if (vtim[p] == vsz) return dp[p];
  int nxt = p + A[p] + nowk;
  if (nxt > n) return 1;
  dp[p] = DP(nxt) + 1;
  vtim[p] = vsz;
  return dp[p];
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &A[i]);
  }
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    Q[i].id = i;
    scanf("%d%d", &Q[i].p, &Q[i].k);
  }
  sort(Q + 1, Q + 1 + m);
  for (int l = 1, r; l <= m; l = r + 1) {
    for (r = l; r + 1 <= m && Q[r + 1].k == Q[l].k; r++)
      ;
    nowk = Q[l].k;
    vsz++;
    for (int i = l; i <= r; i++) {
      ans[Q[i].id] = DP(Q[i].p);
    }
  }
  for (int i = 1; i <= m; i++) {
    printf("%d\n", ans[i]);
  }
  return 0;
}
