#include <bits/stdc++.h>
using namespace std;
int const N = 100 * 1000 + 16;
int const M = 1000 * 1000 * 1000 + 7;
int const inf = 1000 * 1000 * 1000;
int n, m;
int a[N];
int dp[N][320];
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  cin >> n;
  copy_n(istream_iterator<int>(cin), n, a + 1);
  int s = sqrt(n) + 1;
  for (int i = n; i > 0; --i)
    for (int x = 1; x <= s; ++x) {
      int v = i + a[i] + x;
      dp[i][x] = 1 + (v <= n ? dp[v][x] : 0);
    }
  cin >> m;
  while (m--) {
    int p, k;
    cin >> p >> k;
    int ans = 0;
    if (k <= s)
      ans = dp[p][k];
    else {
      while (p <= n) ++ans, p += a[p] + k;
    }
    cout << ans << "\n";
  }
  cout << flush;
}
