#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long MOD = 998244353;
inline long long add(long long x, long long y) {
  x += y;
  if (x >= mod) x -= mod;
  return x;
}
inline long long sub(long long x, long long y) {
  x -= y;
  if (x < 0) x += mod;
  return x;
}
inline long long mul(long long x, long long y) { return (x * 1ll * y) % mod; }
long long sol(long long l, long long r) {
  if (l >= r) return -1;
  cout << '?' << " " << l << " " << r << endl;
  long long x;
  cin >> x;
  return x;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long arr[n + 3];
  for (long long i = 0; i < n; i++) cin >> arr[i];
  long long l = 310;
  long long dp[l][n + 4];
  for (long long i = 1; i < l; i++)
    for (long long j = n - 1; j >= 0; j--) {
      dp[i][j] = 1;
      if (i + j + arr[j] < n) dp[i][j] += dp[i][j + arr[j] + i];
    }
  long long q;
  cin >> q;
  while (q--) {
    long long p, k;
    cin >> p >> k;
    p--;
    if (k < l)
      cout << dp[k][p] << endl;
    else {
      long long ans = 0;
      while (p < n) {
        ans++;
        p = p + k + arr[p];
      }
      cout << ans << endl;
    }
  }
}
