#include <bits/stdc++.h>
template <typename T>
void Scan(T& t) {
  std::cin >> t;
}
template <typename First, typename... Rest>
void Scan(First& first, Rest&... rest) {
  std::cin >> first;
  Scan(rest...);
}
using ll = long long;
using ull = unsigned long long;
constexpr int INFINT = 1 << 30;
constexpr ll INFLL = 1LL << 60;
constexpr double EPS = 0.0000000001;
constexpr int MOD = 1000000007;
int next[20][100005];
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  ;
  int n;
  Scan(n);
  ;
  std::vector<int> x(n);
  for (auto& i : x) std::cin >> i;
  ;
  int l, Q;
  Scan(l, Q);
  ;
  for (int i = 0; i < int(n); ++i) {
    next[0][i] =
        std::distance(std::begin(x),
                      std::upper_bound((x).begin(), (x).end(), x[i] + l)) -
        1;
    if (next[0][i] < i + 1) next[0][i] = n;
  }
  for (int i = (1); i < (20); ++i)
    for (int j = 0; j < int(n); ++j) {
      next[i][j] = next[i - 1][next[i - 1][j]];
      if (next[i][j] == 0) next[i][j] = n;
    }
  for (int q = 0; q < int(Q); ++q) {
    int a, b;
    Scan(a, b);
    ;
    --a;
    --b;
    if (a > b) std::swap(a, b);
    int res = 0;
    for (int i = (std::floor(std::log2(n)) - 1) - 1; i >= 0; --i) {
      if (next[i][a] < b) {
        a = next[i][a];
        res |= (1 << i);
      }
    }
    std::cout << res + 1;
    std::cout << "\n";
    ;
  }
  return 0;
}
