#include <bits/stdc++.h>
using namespace std;
int n, m, k, i, l, q, o, j, to, p, ans, a[1000000], dp[100000 + 10][300];
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = n; i >= 1; i--)
    for (j = 1; j <= 300; j++) {
      to = i + a[i] + j;
      if (to > n)
        dp[i][j] = 1;
      else
        dp[i][j] = dp[to][j] + 1;
    }
  cin >> q;
  for (i = 1; i <= q; i++) {
    cin >> p >> k;
    if (k <= 300) {
      cout << dp[p][k] << "\n";
    } else {
      ans = 0;
      while (p <= n) {
        ans++;
        p += a[p] + k;
      }
      cout << ans << "\n";
    }
  }
}
