#include <bits/stdc++.h>
using namespace std;
vector<long long int> X;
vector<long long int> D;
int main() {
  long long int N;
  cin >> N;
  D = vector<long long int>(N);
  for (size_t i = 0; i < N; i++) {
    cin >> D[i];
  }
  X = vector<long long int>(N);
  long long int idx = 0;
  long long int L, Q;
  cin >> L >> Q;
  while (idx < N && D[idx] - D[0] <= L) {
    idx++;
  }
  if (idx == 0) {
    for (size_t i = 0; i < Q; i++) {
      cout << 1 << endl;
    }
    return 0;
  }
  X[0] = idx - 1;
  for (size_t i = 1; i < N; i++) {
    while (idx < N && D[idx] - D[i] <= L) {
      idx++;
    }
    X[i] = idx - 1;
  }
  vector<pair<int, int>> AB(Q);
  map<pair<int, int>, int> MAB;
  map<int, vector<int>> MIVI;
  vector<long long int> ans(N);
  for (size_t i = 0; i < Q; i++) {
    cin >> AB[i].first >> AB[i].second;
    AB[i].first--;
    AB[i].second--;
    if (AB[i].first > AB[i].second) {
      swap(AB[i].first, AB[i].second);
    }
    MAB[AB[i]] = i;
    MIVI[AB[i].first].push_back(AB[i].second);
  }
  for (auto iii : MIVI) {
    long long int A = iii.first;
    long long int memox = 0;
    for (auto jjj : iii.second) {
      long long int B = jjj;
      while (A < B) {
        A = X[A];
        memox++;
      }
      ans[MAB[make_pair(iii.first, jjj)]] = memox;
    }
  }
  for (size_t i = 0; i < Q; i++) {
    cout << ans[i] << endl;
  }
}
