#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int n, a[100005], q;
int dp[320][100005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = sqrt(n); i >= 1; i--)
    for (int j = n; j >= 1; j--)
      if (i + j + a[j] > n)
        dp[i][j] = 1;
      else
        dp[i][j] = dp[i][i + j + a[j]] + 1;
  cin >> q;
  while (q--) {
    int p, k;
    cin >> p >> k;
    if (k <= sqrt(n))
      cout << dp[k][p] << '\n';
    else {
      int tmp = p, cnt = 0;
      while (tmp <= n) tmp = tmp + a[tmp] + k, cnt++;
      cout << cnt << '\n';
    }
  }
  return 0;
}
