#include <bits/stdc++.h>
int greedy(const std::vector<std::vector<int>> &table, int &a, int b) {
  int lb = 0, ub = 32;
  while (ub - lb > 1) {
    int mid = (lb + ub) >> 1;
    ((table[mid][a] <= b) ? lb : ub) = mid;
  }
  a = table[lb][a];
  return 1 << lb;
}
int answer(const std::vector<std::vector<int>> &table, int a, int b) {
  int next = a, res = 0;
  while (next < b) res += greedy(table, next, b);
  return res;
}
int main() {
  int N;
  scanf("%d", &N);
  std::vector<int> x(N);
  for (int i = 0; i < N; ++i) scanf("%d", &x[i]);
  int L, Q;
  scanf("%d %d", &L, &Q);
  std::vector<std::vector<int>> table(33, std::vector<int>(N));
  for (int i = 0; i < N; ++i)
    table[0][i] =
        std::upper_bound(x.begin(), x.end(), x[i] + L) - x.begin() - 1;
  for (int i = 1; i <= 32; ++i)
    for (int j = 0; j < N; ++j) table[i][j] = table[i - 1][table[i - 1][j]];
  for (int i = 0; i < Q; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    if (a > b) std::swap(a, b);
    --a, --b;
    printf("%d\n", answer(table, a, b));
  }
  return 0;
}
