#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 2;
const int M = 2e6;
const int V = 500;
const int mod = 0;
const int inf = 2e9 + 3;
const long long INF = 1e16;
int dp[V + 20][N], n, q, a[N];
int calc(int p, int k) {
  int ans = 0;
  while (p <= n) {
    ans++;
    p = p + a[p] + k;
  }
  return ans;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int j = 1; j <= V; ++j)
    for (int i = n; i >= 1; --i) dp[j][i] = 1 + dp[j][i + a[i] + j];
  scanf("%d", &q);
  while (q--) {
    int p, k;
    scanf("%d %d", &p, &k);
    if (k <= V)
      printf("%d\n", dp[k][p]);
    else
      printf("%d\n", calc(p, k));
  }
}
