#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, q;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; ++i) cin >> a[i];
  vector<vector<int>> dp(n + 1, vector<int>(51, 0));
  for (int i = 1; i <= 50; ++i) {
    for (int j = n; j > 0; --j) {
      if (j + a[j] + i > n)
        dp[j][i] = 1;
      else
        dp[j][i] = dp[j + a[j] + i][i] + 1;
    }
  }
  cin >> q;
  for (int i = 0; i < q; ++i) {
    int p, k, res = 0;
    cin >> p >> k;
    if (k <= 50) {
      cout << dp[p][k] << endl;
      continue;
    }
    while (p <= n) {
      p += (a[p] + k);
      ++res;
    }
    cout << res << endl;
  }
  return 0;
}
