#include <bits/stdc++.h>
using namespace std;
const int maxm = 1e5 + 5;
const int sq = 350;
int sum[maxm][sq + 5];
int a[maxm];
int n, q;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int k = 1; k <= sq; k++) {
    for (int p = n; p >= 1; p--) {
      if (p + a[p] + k > n)
        sum[p][k] = 1;
      else
        sum[p][k] = sum[p + a[p] + k][k] + 1;
    }
  }
  cin >> q;
  while (q--) {
    int p, k;
    cin >> p >> k;
    if (k >= sq) {
      int ans = 0;
      while (p <= n) {
        p = p + a[p] + k;
        ans++;
      }
      cout << ans << endl;
    } else {
      cout << sum[p][k] << endl;
    }
  }
  return 0;
}
