#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int INFINT = INT_MAX / 2;
unsigned long long MinimumDays(vector<unsigned long long> &xs,
                               unsigned long long a, unsigned long long b,
                               unsigned long long L) {
  if (a > b) swap(a, b);
  unsigned long long now = xs[a];
  unsigned long long res = 0;
  while (now + L < xs[b]) {
    vector<unsigned long long>::iterator itr =
        upper_bound(xs.begin(), xs.end(), now + L);
    itr--;
    now = *itr;
    res++;
  }
  res++;
  return res;
}
int main() {
  int N;
  cin >> N;
  vector<unsigned long long> xs(N);
  for (int i = 0; i < N; i++) {
    cin >> xs[i];
  }
  sort(xs.begin(), xs.end());
  unsigned long long L, a, b;
  int Q;
  cin >> L >> Q;
  for (int i = 0; i < Q; i++) {
    cin >> a >> b;
    cout << MinimumDays(xs, a - 1, b - 1, L) << endl;
  }
  return 0;
}
