#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> X(N);
  for (int i = (0); i < (N); ++i) cin >> X[i];
  int L, Q;
  cin >> L >> Q;
  vector<pair<int, int> > AB(Q);
  for (int i = (0); i < (Q); ++i) cin >> AB[i].first >> AB[i].second;
  for (int i = (0); i < (Q); ++i) {
    int cur = AB[i].first - 1, end = AB[i].second - 1;
    if (cur > end) swap(cur, end);
    int ret = 0;
    while (cur < end) {
      int next = cur;
      while ((next < end) && (L >= (X[next + 1] - X[cur]))) {
        next++;
      }
      cur = next;
      ret++;
    }
    cout << ret << endl;
  }
  return 0;
}
