#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
const int N = 1e5 + 123;
int n, a[N], dp[N][200];
bool was[200][200];
void precalc() {
  for (int k = 1; k <= 100; ++k) {
    for (int i = n; i > 0; --i) {
      int x = i + k + a[i];
      if (x > n)
        dp[i][k] = 1;
      else
        dp[i][k] = dp[x][k] + 1;
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }
  precalc();
  int q;
  int p, k, cnt;
  scanf("%d", &q);
  while (q--) {
    scanf("%d%d", &p, &k);
    cnt = 0;
    if (k <= 100)
      printf("%d\n", dp[p][k]);
    else {
      while (p <= n) {
        ++cnt;
        p += a[p] + k;
      }
      printf("%d\n", cnt);
    }
  }
}
