#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;
  }
  for (size_t i = 0; i < Q; i++) {
    long long int A, B;
    cin >> A >> B;
    A--;
    B--;
    if (A > B) {
      swap(A, B);
    }
    long long int ans = 0;
    while (A < B) {
      A = X[A];
      ans++;
    }
    cout << ans << endl;
  }
}
