#include <bits/stdc++.h>
using namespace std;
int N, Q;
int A[100000];
int S[101][100000];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  for (int i = 0; i < (N); i++) cin >> A[i];
  for (int k = 1; k <= 100; k++) {
    for (int i = N - 1; i >= 0; i--) {
      int t = i + A[i] + k;
      if (t >= N)
        S[k][i] = 1;
      else
        S[k][i] = S[k][t] + 1;
    }
  }
  cin >> Q;
  for (int i = 0; i < (Q); i++) {
    int p, k;
    cin >> p >> k;
    if (k > 100) {
      int c = 0;
      while (p <= N) {
        p = p + A[p - 1] + k;
        c++;
      }
      cout << c << "\n";
    } else {
      cout << S[k][p - 1] << "\n";
    }
  }
  return 0;
}
