#include <bits/stdc++.h>
using namespace std;
template <class T>
using vec = std::vector<T>;
template <class T>
using vec2d = std::vector<std::vector<T>>;
bool __hack = std::ios::sync_with_stdio(false);
auto __hack1 = cin.tie(nullptr);
namespace template_util {
constexpr int bytecount(uint64_t x) { return x ? 1 + bytecount(x >> 8) : 0; }
template <int N>
struct bytetype {};
template <uint64_t N>
struct minimal_uint : bytetype<bytecount(N)> {};
}  // namespace template_util
template <class T>
T next(istream& in) {
  T ret;
  in >> ret;
  return ret;
}
template <class T>
vector<T> next_vec(istream& in, size_t n) {
  vector<T> ret(n);
  for (size_t i = 0; i < n; ++i) {
    ret[i] = next<T>(in);
  }
  return ret;
}
void solve(istream& in, ostream& out) {
  auto n = next<int>(in);
  auto x = next_vec<int>(in, n);
  auto L = next<int>(in);
  vec2d<int> to;
  vec<int> to1(n - 1);
  int ptr = 0;
  int64_t sum = 0;
  for (int i = 0; i < (n - 1); ++i) {
    while (ptr + 1 < n && x[ptr + 1] - x[ptr] + sum <= L) {
      sum += x[ptr + 1] - x[ptr];
      ++ptr;
    }
    to1[i] = ptr;
    sum -= (x[i + 1] - x[i]);
  }
  to1.push_back(n - 1);
  to.push_back(to1);
  for (int d = 2; d < n; d *= 2) {
    to1 = vec<int>(n - 1);
    for (int i = 0; i < (n - 1); ++i) {
      to1[i] = to.back()[to.back()[i]];
    }
    to1.push_back(n - 1);
    to.push_back(to1);
  };
  ;
  auto nq = next<int>(in);
  while (nq--) {
    auto a = next<int>(in) - 1;
    auto b = next<int>(in) - 1;
    if (a > b) {
      swap(a, b);
    }
    int64_t res = 0;
    for (int i = (int)to.size() - 1; i >= 0; --i) {
      if (to[i][a] > b) {
        continue;
      }
      res += (1LL << i);
      a = to[i][a];
    }
    out << res << "\n";
  }
}
int main() {
  solve(cin, cout);
  return 0;
}
