#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  register int c = getchar();
  x = 0;
  int neg = 0;
  for (; ((c < 48 || c > 57) && c != '-'); c = getchar())
    ;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (neg) x = -x;
}
inline void writeln(int x) {
  char buffor[21];
  register int i = 0;
  int neg = 0;
  if (x < 0) {
    neg = 1;
    x = -x;
  }
  do {
    buffor[i++] = (x % 10) + '0';
    x /= 10;
  } while (x);
  i--;
  if (neg) putchar('-');
  while (i >= 0) putchar(buffor[i--]);
  putchar('\n');
}
const int N = (int)1e5 + 10;
int n, a[N];
int q, ans[400][N];
void input() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
}
void solve() {
  int can = sqrt(n);
  for (int k = 1; k <= can; k++) {
    for (int i = n; i >= 1; i--) {
      int tmp = i + a[i] + k;
      if (tmp > n)
        ans[k][i] = 1;
      else
        ans[k][i] = ans[k][tmp] + 1;
    }
  }
  cin >> q;
  for (int i = 1; i <= q; i++) {
    int p, k;
    cin >> p >> k;
    if (k <= can)
      cout << ans[k][p] << '\n';
    else {
      int res = 0;
      while (p <= n) {
        p += a[p] + k;
        res++;
      }
      cout << res << '\n';
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  input();
  solve();
  return 0;
}
