#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) cin >> a[i];
  int q;
  cin >> q;
  vector<vector<int> > dp(n + 1, vector<int>(sqrt(n) + 1));
  for (int k = 0; k < dp[0].size(); k++) {
    for (int i = n; i >= 1; i--) {
      if (i + a[i] + k > n)
        dp[i][k] = 1;
      else
        dp[i][k] = 1 + dp[i + a[i] + k][k];
    }
  }
  while (q--) {
    int p, k;
    cin >> p >> k;
    int ans = 0;
    if (k >= dp[0].size()) {
      for (; p <= n; ++ans, p = p + k + a[p])
        ;
    } else {
      ans = dp[p][k];
    }
    cout << ans << endl;
  }
  return 0;
}
