#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, int> c;
int a[100500];
int dp[100500][350];
int main() {
  int n, sq;
  scanf("%d", &n);
  sq = sqrt(n);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  for (int i = 1; i <= sq; i++) {
    for (int j = n - 1; j > -1; j--) {
      if (j + a[j] + i > n)
        dp[j][i] = 1;
      else
        dp[j][i] = dp[j + a[j] + i][i] + 1;
    }
  }
  int q;
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    x--;
    if (y <= sq)
      printf("%d\n", dp[x][y]);
    else {
      int ans = 0, res = x;
      while (res < n) {
        ans++;
        res += a[res] + y;
      }
      printf("%d\n", ans);
    }
  }
  return 0;
}
