#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
const int MAX = 100005;
const int STALA = 18;
int tab[MAX];
int ancestor[MAX][STALA];
int ans[MAX];
int SQRT;
int n;
vector<pair<int, int> > query[MAX];
void brut1(int p, int k, int i) {
  int answer = 0;
  while (p <= n) {
    p = p + tab[p] + k;
    answer++;
  }
  ans[i] = answer;
}
void lca(int start, int index) {
  int answer = 0;
  for (int i = STALA - 1; i >= 0; i--) {
    if (ancestor[start][i] <= n) {
      start = ancestor[start][i];
      answer += (1 << i);
    }
  }
  answer++;
  ans[index] = answer;
}
void make_query(int id) {
  for (int i = 1; i <= n; i++) {
    if (i + id + tab[i] > n) {
      ancestor[i][0] = n + 1;
    } else
      ancestor[i][0] = i + id + tab[i];
  }
  ancestor[n + 1][0] = n + 1;
  for (int i = 1; i < STALA; i++) {
    for (int j = 1; j <= n + 1; j++) {
      ancestor[j][i] = ancestor[ancestor[j][i - 1]][i - 1];
    }
  }
  for (auto it : query[id]) {
    lca(it.first, it.second);
  }
}
void brut2() {
  for (int i = 1; i <= n; i++) {
    if (!query[i].empty()) {
      make_query(i);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> tab[i];
  }
  int q;
  cin >> q;
  SQRT = 100;
  for (int i = 0; i < q; i++) {
    int p, k;
    cin >> p >> k;
    if (k > SQRT) {
      brut1(p, k, i);
    } else {
      query[k].push_back(make_pair(p, i));
    }
  }
  brut2();
  for (int i = 0; i < q; i++) {
    cout << ans[i] << "\n";
  }
  return 0;
}
