#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
const int MAXM = 400;
int N, P, K, Q;
int a[MAXN], dp[MAXN][MAXM + 5];
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &a[i]);
  }
  scanf("%d", &Q);
  for (int j = 1; j <= MAXM; j++) {
    for (int i = N; i >= 1; i--) {
      if (i + a[i] + j > N)
        dp[i][j] = 1;
      else
        dp[i][j] = dp[i + a[i] + j][j] + 1;
    }
  }
  for (int i = 1; i <= Q; i++) {
    scanf("%d%d", &P, &K);
    if (K < MAXM) {
      printf("%d\n", dp[P][K]);
      continue;
    }
    int tot = 0;
    while (P <= N) {
      P += a[P] + K;
      tot++;
    }
    printf("%d\n", tot);
  }
  return 0;
}
