#include <bits/stdc++.h>
using namespace std;
int dx4[4] = {1, 0, -1, 0};
int dy4[4] = {0, 1, 0, -1};
int dx8[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int main(void) {
  int N;
  cin >> N;
  vector<int> x(N);
  for (long long i = 0; i < N; ++i) cin >> x[i];
  sort((x).begin(), (x).end());
  int L, Q;
  cin >> L >> Q;
  for (long long i = 0; i < Q; ++i) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    long long counter = 1;
    if (a < b) {
      if (x[a] + L >= x[b]) {
        cout << 1 << endl;
        continue;
      } else {
        vector<int>::iterator ite;
        ite = upper_bound((x).begin(), (x).end(), x[a] + L);
        --ite;
        while (true) {
          if (*ite + L >= x[N - 1]) {
            ++counter;
            break;
          } else {
            ite = upper_bound((x).begin(), (x).end(), *ite + L);
            --ite;
            ++counter;
            if (*ite >= x[b]) break;
          }
        }
      }
      cout << counter << endl;
    } else {
      if (x[a] - L <= x[b]) {
        cout << 1 << endl;
        continue;
      } else {
        vector<int>::iterator ite;
        ite = lower_bound((x).begin(), (x).end(), x[a] - L);
        while (true) {
          if (*ite - L <= x[0]) {
            ++counter;
            break;
          } else {
            ite = lower_bound((x).begin(), (x).end(), *ite - L);
            ++counter;
            if (*ite <= x[b]) break;
          }
        }
      }
      cout << counter << endl;
    }
  }
}
