#include <bits/stdc++.h>
using namespace std;
int arr[100007], dp[100007][321], n, raiz;
int solve(int p, int k) {
  if (p > n) return 0;
  if (dp[p][k] != -1) return dp[p][k];
  int novo_valor = p + arr[p] + k;
  return dp[p][k] = solve(novo_valor, k) + 1;
}
int main() {
  int i, queries, p, k, ops, atual, j;
  scanf("%d", &n);
  raiz = sqrt(n);
  for (i = 1; i <= n; i++) scanf("%d", &arr[i]);
  memset(dp, -1, sizeof(dp));
  for (i = 1; i <= n; i++)
    for (j = 1; j <= raiz; j++) solve(i, j);
  scanf("%d", &queries);
  for (i = 0; i < queries; i++) {
    scanf("%d %d", &p, &k);
    if (k > raiz) {
      ops = 0;
      atual = p;
      while (p <= n) p += arr[p] + k, ops += 1;
      printf("%d\n", ops);
    } else
      printf("%d\n", dp[p][k]);
  }
  return 0;
}
