#include <bits/stdc++.h>
using namespace std;
template <typename T>
vector<vector<T> > doubling(vector<T> vec, int depth) {
  int s = (int)vec.size();
  int vs = 1;
  while (1 << vs <= depth) vs++;
  vector<vector<T> > tbl(vs, vector<T>(s));
  for (int j = 0; j < s; j++) tbl[0][j] = vec[j];
  for (int i = 1; i < vs; i++) {
    for (int j = 0; j < s; j++) {
      tbl[i][j] = tbl[i - 1][tbl[i - 1][j]];
    }
  }
  return tbl;
}
void Main() {
  int N;
  scanf("%d", &N);
  vector<int> X(N);
  for (int i = int(0); i < int(N); ++i) scanf("%d", &X[i]);
  int LIM, Q;
  scanf("%d%d", &LIM, &Q);
  vector<int> L(N), R(N);
  for (int i = int(0); i < int(N); ++i) {
    int x = X[i];
    int r =
        distance(X.begin(), upper_bound((X).begin(), (X).end(), x + LIM)) - 1;
    int l = distance(X.begin(), lower_bound((X).begin(), (X).end(), x - LIM));
    L[i] = l;
    R[i] = r;
  }
  auto lt = doubling(L, 100001);
  auto rt = doubling(R, 100001);
  int H = ((int)(lt).size());
  for (int q = int(0); q < int(Q); ++q) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    if (a < b) {
      int ans = 0;
      auto &par = rt;
      for (int k = int(H) - 1; k >= int(0); k--) {
        if (par[k][a] <= b) {
          ans += (1LL << (k));
          a = par[k][a];
        }
      }
      if (a < b) ans++;
      (void)printf("%d\n", ans);
    } else {
      int ans = 0;
      auto &par = lt;
      for (int k = int(H) - 1; k >= int(0); k--) {
        if (par[k][a] >= b) {
          ans += (1LL << (k));
          a = par[k][a];
        }
      }
      if (a > b) ans++;
      (void)printf("%d\n", ans);
    }
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  Main();
  return 0;
}
