#include <bits/stdc++.h>
using namespace std;
int a[100005], f[100005][320], n, m, t, x, k;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  t = int(sqrt(double(n)));
  cin >> m;
  for (int i = 1; i <= t; i++) {
    for (int j = n; j >= 1; j--) {
      if (j + a[j] + i > n)
        f[j][i] = 1;
      else
        f[j][i] = f[j + a[j] + i][i] + 1;
    }
  }
  for (int i = 1; i <= m; i++) {
    int ans = 0;
    cin >> x >> k;
    if (k <= t) {
      cout << f[x][k] << endl;
    } else {
      while (x <= n) {
        ans++;
        x += a[x] + k;
      }
      cout << ans << endl;
    }
  }
  return 0;
}
