#include <bits/stdc++.h>
using namespace std;
int n, q, k;
int arr[100100];
int dp[333][100100];
int solve(int p) {
  if (p > n) return 0;
  int &ret = dp[k][p];
  if (~ret) return dp[k][p];
  return ret = 1 + solve(p + arr[p] + k);
}
int solve2(int p) {
  if (p > n) return 0;
  return 1 + solve2(p + arr[p] + k);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &arr[i]);
  scanf("%d", &q);
  int p;
  memset(dp, -1, sizeof dp);
  while (q--) {
    scanf("%d", &p), scanf("%d", &k);
    if (k < 333)
      printf("%d\n", solve(p));
    else
      printf("%d\n", solve2(p));
  }
}
