#include <bits/stdc++.h>
using namespace std;
int n, d[100005];
int game(int a, int b) {
  int ans = 0;
  while (a <= n) {
    ans++;
    a += d[a] + b;
  }
  return ans;
}
int dp[100005][405], q, a, b;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> d[i];
  }
  for (int i = n; i >= 1; i--) {
    for (int j = 1; j <= 400; j++) {
      if (i + j + d[i] > n) {
        dp[i][j] = 1;
        continue;
      }
      dp[i][j] = dp[i + j + d[i]][j] + 1;
    }
  }
  cin >> q;
  while (q--) {
    cin >> a >> b;
    if (b <= (int)sqrt(n)) {
      cout << dp[a][b] << endl;
    } else
      cout << game(a, b) << endl;
  }
}
