#include <bits/stdc++.h>
using namespace std;
int arr[100010], n;
int dp[100010][321];
bool v[100010][321];
int sana(int a, int b) {
  if (a > n) return 0;
  if (v[a][b]) return dp[a][b];
  v[a][b] = 1;
  return dp[a][b] = sana(a + arr[a] + b, b) + 1;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int k, i, q, a, b, ans;
  cin >> n;
  k = sqrt(n);
  for (i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  cin >> q;
  while (q--) {
    cin >> a >> b;
    ans = 0;
    if (b < k) {
      ans = sana(a, b);
    } else {
      while (a <= n) {
        a += arr[a] + b;
        ans++;
      }
    }
    cout << ans << '\n';
  }
  return 0;
}
