#include <bits/stdc++.h>
using namespace std;
using LD = long double;
template <class T>
using vec = vector<T>;
using VB = vec<bool>;
using WB = vec<VB>;
using VC = vec<char>;
using WC = vec<VC>;
using VI = vec<long long>;
using WI = vec<VI>;
using VD = vec<LD>;
using WD = vec<VD>;
using VS = vec<string>;
using WS = vec<VS>;
using PI = pair<long long, long long>;
using VPI = vec<PI>;
using WPI = vec<VPI>;
using MI = map<long long, long long>;
using VMI = vec<MI>;
bool debug;
void settings();
void solve();
signed main(signed argc, char* argv[]) {
  debug = false;
  if (!debug) {
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
  cout << fixed << setprecision(20);
  cerr << fixed << setprecision(20);
  settings();
  solve();
  return 0;
}
template <class T>
struct Graph {
  bool directed = false;
  long long nv = -1;
  long long ne = -1;
  vec<map<long long, T>> e;
  Graph<T> rev() {
    if (not directed) return *this;
    Graph<T> g = *this;
    for (auto& ei : g.e) ei.clear();
    for (auto i0_to = (nv), i = decltype(nv)(0); i < i0_to; i++)
      for (auto& p : e[i]) g.e[p.first][i] = p.second;
    return g;
  }
};
using GraphI = Graph<long long>;
template <class T>
inline istream& operator>>(istream& s, vec<T>& v) {
  for (auto&& p : v) s >> p;
  return s;
}
long long INPUT_GRAPH_index_sub = 1, INPUT_GRAPH_cost = 0;
bool INPUT_GRAPH_allow_empty = false;
template <class T>
inline istream& operator>>(istream& s, Graph<T>& g) {
  const long long sub = INPUT_GRAPH_index_sub, cost = INPUT_GRAPH_cost,
                  emptyp = INPUT_GRAPH_allow_empty;
  if (g.nv + emptyp <= 0 and g.ne + emptyp <= 0) {
    s >> g.nv >> g.ne;
  }
  g.e = VMI(g.nv);
  for (auto i0_to = (g.ne), i = decltype(g.ne)(0); i < i0_to; i++) {
    long long x, y;
    T d = cost;
    s >> x >> y;
    if (!d) s >> d;
    g.e[x - sub][y - sub] = d;
    if (not g.directed) g.e[y - sub][x - sub] = d;
  }
  return s;
}
template <class T, class S>
inline ostream& operator<<(ostream&, const pair<T, S>&);
template <class T>
inline ostream& operator<<(ostream&, const vec<T>&);
template <class T, class S>
inline ostream& operator<<(ostream&, const map<T, S>&);
template <class T>
inline ostream& operator<<(ostream&, const Graph<T>&);
template <class T, class S>
inline ostream& operator<<(ostream& s, const pair<T, S>& p) {
  return s << "(" << p.first << "," << p.second << ")";
}
template <class T>
inline ostream& operator<<(ostream& s, const vec<T>& v) {
  long long i = 0;
  for (const auto& v0_elem : v) {
    if (i++) s << ' ';
    s << v0_elem;
  }
  return s;
}
template <class T, class S>
inline ostream& operator<<(ostream& s, const map<T, S>& m) {
  long long i = 0;
  for (const auto& m0_elem : m) {
    if (i++) s << ' ';
    s << m0_elem;
  }
  return s;
}
template <class T>
inline ostream& operator<<(ostream& s, const vec<vec<T>>& w) {
  long long i = 0;
  for (const auto& w0_elem : w) {
    if (i++) s << '\n';
    s << w0_elem;
  }
  return s;
}
template <class T, class S>
inline ostream& operator<<(ostream& s, const vec<map<T, S>>& vm) {
  long long i = 0;
  for (const auto& vm0_elem : vm) {
    if (i++) s << '\n';
    s << vm0_elem;
  }
  return s;
}
template <class T>
inline ostream& operator<<(ostream& s, const Graph<T>& g) {
  return s << "Graph(nv:" << g.nv << " ne:" << g.ne << " e:[" << '\n'
           << g.e << '\n'
           << "])";
}
inline void RD() {}
template <class T, class... S>
inline T& RD(T& t, S&... s) {
  cin >> t;
  RD(s...);
  return t;
}
template <class T, class... S>
inline vec<T>& RD(vec<T>& t, vec<S>&... s) {
  for (auto i0_to = (t.size()), i = decltype(t.size())(0); i < i0_to; i++) {
    RD(t[i], s[i]...);
  }
  return t;
}
template <class T, class... A>
inline T READ(A... a) {
  T t(a...);
  cin >> t;
  return t;
}
template <class T>
inline void dddf(const T& t) {
  if (debug) cerr << t << '\n';
}
template <class T, class... U>
inline void dddf(const T& t, const U&... u) {
  if (debug) {
    cerr << t << ", ";
    dddf(u...);
  }
}
template <class T>
inline T max(const pair<T, T>& p) {
  return max(p.first, p.second);
}
template <class T>
inline T min(const pair<T, T>& p) {
  return min(p.first, p.second);
}
template <class T>
inline T max(const vec<T>& v) {
  return *max_element(begin(v), end(v));
}
template <class T>
inline T min(const vec<T>& v) {
  return *min_element(begin(v), end(v));
}
template <class T>
inline T sum(const vec<T>& v) {
  T s = v.empty() ? 0 : v[0];
  for (auto i0_to = (v.size()), i = decltype(v.size())(1); i < i0_to; i++)
    s += v[i];
  return s;
}
template <class T>
inline T sum(const vec<T>& v, long long mod) {
  T s = v.empty() ? 0 : v[0];
  for (auto i0_to = (v.size()), i = decltype(v.size())(1); i < i0_to; i++)
    (s += v[i]) %= mod;
  return s;
}
template <class T, class U>
inline T dig(const U& d, const T& t) {
  return t;
}
template <class T, class U, class... I>
inline U dig(const U& d, const T& t, long long i, I... j) {
  return 0 <= i && i < t.size() ? dig(d, t[i], j...) : d;
}
template <class T>
inline signed SIZE(const T& t) {
  return t.size();
}
inline LD AC(LD d) { return d ? d : 0; }
[[maybe_unused]] constexpr long long INF = 1LL << 60;
[[maybe_unused]] constexpr long long MOD = 1000000007;
void settings() {}
void solve() {
  long long N;
  long long L;
  long long Q;
  cin >> N;
  VI X(N);
  for (auto Ri_00_to = (N), Ri_0 = decltype(N)(0); Ri_0 < Ri_00_to; Ri_0++) {
    cin >> X[Ri_0];
  }
  cin >> L;
  cin >> Q;
  VI A(Q);
  VI B(Q);
  for (auto Ri_00_to = (Q), Ri_0 = decltype(Q)(0); Ri_0 < Ri_00_to; Ri_0++) {
    cin >> A[Ri_0];
    --A[Ri_0];
    cin >> B[Ri_0];
    --B[Ri_0];
  }
  const long long logN = 17;
  WI go(logN, VI(N));
  for (auto b0_to = (logN), b = decltype(logN)(0); b < b0_to; b++) {
    long long l = L << b;
    long long g = 0;
    for (auto i0_to = (N), i = decltype(N)(0); i < i0_to; i++) {
      while (g + 1 < N && X[g + 1] - X[i] <= l) ++g;
      go[b][i] = g;
    }
  }
  if (debug) {
    cerr << "go"
         << " = ";
    dddf(go);
  };
  for (auto i0_to = (Q), i = decltype(Q)(0); i < i0_to; i++) {
    if (A[i] > B[i]) swap(A[i], B[i]);
    long long ok = N, ng = 0;
    while (abs(ok - ng) > 1) {
      long long test = (ok + ng) / 2;
      long long now = A[i];
      for (auto b0_to = decltype((logN)-1)(0), b = ((logN)-1); b >= b0_to; b--)
        if (test & (1 << b)) {
          now = go[b][A[i]];
        }
      if (now >= B[i])
        ok = test;
      else
        ng = test;
    }
    cout << ok << '\n';
  }
}
