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