#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
  int n;
  cin >> n;
  vector<int> x(n);
  for (int i = 0; i < (int)n; ++i) {
    int a;
    cin >> x[i];
  }
  int l, q;
  cin >> l >> q;
  vector<int> y(n, 0);
  y[0] = 1;
  int d = 0;
  for (int i = (int)(1); i < (int)(n); ++i) {
    y[i] = y[i - 1];
    d += x[i] - x[i - 1];
    if (d > l) {
      y[i]++;
      d = x[i] - x[i - 1];
    }
  }
  y[0] = 0;
  for (int i = 0; i < (int)q; ++i) {
    int a, b;
    cin >> a >> b;
    cout << abs(y[b - 1] - y[a - 1]) << endl;
  }
  return 0;
}
