#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p) {
  return os << '(' << p.first << ", " << p.second << ')';
}
template <typename T_container, typename T = typename enable_if<
                                    !is_same<T_container, string>::value,
                                    typename T_container::value_type>::type>
ostream &operator<<(ostream &os, const T_container &v) {
  os << '{';
  string sep;
  for (const T &x : v) os << sep << x, sep = ", ";
  return os << '}';
}
void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << ' ' << H;
  dbg_out(T...);
}
using vi = vector<long long>;
using pii = pair<long long, long long>;
using vp = vector<pii>;
using vv = vector<vector<long long>>;
const long long MOD = (long long)1e9 + 7;
const long long MOD2 = (long long)998244353;
const long long inf = (long long)1e18 + 1;
long long powb(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a;
    a = a * a;
    n >>= 1;
  }
  return res;
}
long long powb(long long a, long long n, long long m) {
  a %= m;
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = (res * a) % m;
    a = (a * a) % m;
    n >>= 1;
  }
  return res;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vi ar(n + 1);
  for (long long i = 1; i < n + 1; i++) cin >> ar[i];
  ;
  vv dp(n + 1, vi(sqrt(n) + 1));
  for (long long k = 1; k <= (long long)sqrt(n); k++) {
    for (long long p = n; p >= 1; p--) {
      if (p + ar[p] + k > n)
        dp[p][k] = 1;
      else
        dp[p][k] = dp[p + ar[p] + k][k] + 1;
    }
  };
  long long q;
  cin >> q;
  long long p, k;
  for (long long i = 0; i < q; i++) {
    cin >> p >> k;
    if (k <= (long long)sqrt(n)) {
      cout << dp[p][k] << "\n";
      ;
    } else {
      long long ans = 1;
      while (p + ar[p] + k <= n) {
        ans++;
        p = p + ar[p] + k;
      }
      cout << ans << "\n";
      ;
    }
  }
  return 0;
}
