#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n, dp[maxn][510], p, k, a[maxn], q;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int j = 0; j <= 500; j++) {
    for (int i = n - 1; i >= 0; i--) {
      if (i + a[i] + j >= n)
        dp[i][j] = 1;
      else
        dp[i][j] = dp[i + a[i] + j][j] + 1;
    }
  }
  cin >> q;
  while (q--) {
    cin >> p >> k;
    p--;
    if (k > 500) {
      int now = p, ans = 0;
      while (now < n) {
        now = now + a[now] + k;
        ans++;
      }
      cout << ans << '\n';
    } else
      cout << dp[p][k] << '\n';
  }
}
