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