#include <bits/stdc++.h>
using namespace std;
int dp[333][100005] = {};
int main() {
  int n;
  cin >> n;
  int a[100005];
  for (int i = 0; i < n; ++i) scanf("%d", a + i + 1);
  for (int k = 1; k < 333; k++) {
    dp[k][n] = 1;
    for (int i = n - 1; i >= 1; --i) {
      if (i + a[i] + k > n) {
        dp[k][i] = 1;
      } else {
        dp[k][i] = dp[k][i + a[i] + k] + 1;
      }
    }
  }
  int q;
  cin >> q;
  while (q--) {
    int p, k;
    scanf("%d%d", &p, &k);
    if (k < 333) {
      printf("%d\n", dp[k][p]);
    } else {
      int res = 0;
      while (p <= n) {
        p += a[p] + k;
        res++;
      }
      printf("%d\n", res);
    }
  }
}
