#include <bits/stdc++.h>
using namespace std;
int N, v[100010], d[100010], i, crt, L, Q, a, b;
int main() {
  cin >> N;
  for (i = 1; i <= N; i++) {
    cin >> v[i];
  }
  cin >> L;
  d[1] = 1;
  crt = 0;
  for (int i = 2; i <= N; i++) {
    if (crt + v[i] - v[i - 1] <= L) {
      crt += v[i] - v[i - 1];
      d[i] = d[i - 1];
    } else {
      crt = 0;
      d[i] = d[i - 1] + 1;
    }
  }
  cin >> Q;
  for (i = 0; i < Q; i++) {
    cin >> a >> b;
    if (a > b) {
      swap(a, b);
    }
    cout << d[b] - d[a - 1] + 1 << '\n';
  }
  return 0;
}
