/* -------------------------------- Template -------------------------------- */

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = std::min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = std::max(a, b); }

template<typename T> constexpr T inf = [](){ assert(false); };
// template<> constexpr int inf<int> = 1e9;
// template<> constexpr ll inf<ll> = 1e18;
// template<> constexpr ld inf<ld> = 1e30;

struct yes_no : std::numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

class range {
  class Index {
    int x;
  public:
    Index(int x) : x(x) {}
    int operator*() const { return x; }
    bool operator!=(Index &r) { return x < r.x; }
    void operator++() { ++x; }
  };
  Index i, n;
public:
  range(int n) : i(0), n(n) {}
  range(int i, int n) : i(i), n(n) {}
  Index &begin() { return i; }
  Index &end() { return n; }
};

template <class A, class B> class zip_t {
  using res_t = std::pair<typename A::iterator, typename B::iterator>;
  class iter : public std::iterator<std::input_iterator_tag,
                                    res_t,          // value_type
                                    std::ptrdiff_t, // difference_type
                                    res_t*,         // pointer
                                    res_t> {        // reference
    typename A::iterator a; typename B::iterator b;
  public:
    iter(typename A::iterator a, typename B::iterator b) : a(a), b(b) {}
    res_t operator*() { return res_t(*a, *b); }
    bool operator==(iter x) { return a == x.a; }
    bool operator!=(iter x) { return !(*this == x); }
    iter& operator++() { ++a; ++b; return *this; }
    iter operator++(int) { iter ret = *this; ++(*this); return ret; }
  };
  iter i, n;
public:
  zip_t(A &a, B &b) : i(a.begin(), b.begin()), n(a.end(), b.end()) {}
  iter &begin() { return i; }
  iter &end() { return n; }
};

template<typename A, typename B>
zip_t<A, B> zip(A &a, B &b) { return zip_t<A, B>(a, b); }

void solve();

int main() {
  std::locale loc(std::locale(), new yes_no);
  std::cout << std::boolalpha << std::setprecision(12) << std::fixed;
  std::cout.imbue(loc);
  solve();
  return 0;
}

using namespace std;

/* -------------------------------- Library -------------------------------- */

/* ---------------------------------- Main ---------------------------------- */

int step[18][101000];

void solve() {
  int N, L, Q;
  cin >> N;
  vector<int> x(N);
  for (int &i: x) cin >> i;
  x.push_back(2e9);
  cin >> L >> Q;
  for (int i: range(N)) {
    step[0][i] = upper_bound(ALL(x), x[i] + L) - begin(x) - 1;
  }
  for (int i: range(17)) {
    for (int j: range(N)) {
      step[i+1][j] = step[i][step[i][j]];
    }
  }
  while (Q--) {
    int a, b; cin >> a >> b; --a; --b;
    if (a > b) swap(a, b);
    int res = 0;
    for (int i = 17; i >= 0; --i) {
      int c = step[i][a];
      if (c < b) { a = c; res += 1 << i; }
    }
    cout << res + 1 << endl;
  }
  return;
}


Measured memory_bytes: 8312