#include <bits/stdc++.h>
using namespace std;
int n, a[111111 + 5], dp[111111 + 5][300 + 5], m, p, k;
int main() {
  ios_base::sync_with_stdio(0);
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = n; i >= 1; i--)
    for (int j = 1; j <= 300; j++) {
      if (i + a[i] + j > n)
        dp[i][j] = 1;
      else
        dp[i][j] = dp[i + a[i] + j][j] + 1;
    }
  scanf("%d", &m);
  while (m--) {
    scanf("%d %d", &p, &k);
    int res = 0;
    if (k < 300 && p <= n)
      res = dp[p][k];
    else
      while (p <= n) {
        p = p + a[p] + k;
        res++;
      }
    printf("%d \n", res);
  }
}
