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