#include <bits/stdc++.h>
const int N = 1e5 + 1, B = 128;
int i, j, n, m, r, a[N], f[N][B];
int main() {
  for (scanf("%d", &n); ++i <= n; scanf("%d", a + i))
    ;
  for (j = 1; j < B; ++j)
    for (i = n; i; --i) f[i][j] = i + j + a[i] > n ? 1 : f[i + j + a[i]][j] + 1;
  for (scanf("%d", &m); m--;) {
    scanf("%d%d", &i, &j);
    if (j < B)
      printf("%d\n", f[i][j]);
    else {
      for (r = 0; i <= n; i += j + a[i]) ++r;
      printf("%d\n", r);
    }
  }
}
