#include <bits/stdc++.h>
using namespace std;
template <typename _KTy, typename _Ty>
ostream& operator<<(ostream& o, const pair<_KTy, _Ty>& m) {
  o << "{" << m.first << ", " << m.second << "}";
  return o;
}
template <typename _KTy, typename _Ty>
ostream& operator<<(ostream& o, const map<_KTy, _Ty>& m) {
  if (m.empty()) {
    o << "{ }";
    return o;
  }
  o << "{" << *m.begin();
  for (auto itr = ++m.begin(); itr != m.end(); itr++) {
    o << ", " << *itr;
  }
  o << "}";
  return o;
}
template <typename _KTy, typename _Ty>
ostream& operator<<(ostream& o, const unordered_map<_KTy, _Ty>& m) {
  if (m.empty()) {
    o << "{ }";
    return o;
  }
  o << "{" << *m.begin();
  for (auto itr = ++m.begin(); itr != m.end(); itr++) {
    o << ", " << *itr;
  }
  o << "}";
  return o;
}
template <typename _Ty>
ostream& operator<<(ostream& o, const vector<_Ty>& v) {
  if (v.empty()) {
    o << "{ }";
    return o;
  }
  o << "{" << v.front();
  for (auto itr = ++v.begin(); itr != v.end(); itr++) {
    o << ", " << *itr;
  }
  o << "}";
  return o;
}
template <typename _Ty>
ostream& operator<<(ostream& o, const set<_Ty>& s) {
  if (s.empty()) {
    o << "{ }";
    return o;
  }
  o << "{" << *(s.begin());
  for (auto itr = ++s.begin(); itr != s.end(); itr++) {
    o << ", " << *itr;
  }
  o << "}";
  return o;
}
template <typename _Ty>
ostream& operator<<(ostream& o, const unordered_set<_Ty>& s) {
  if (s.empty()) {
    o << "{ }";
    return o;
  }
  o << "{" << *(s.begin());
  for (auto itr = ++s.begin(); itr != s.end(); itr++) {
    o << ", " << *itr;
  }
  o << "}";
  return o;
}
template <typename _Ty>
ostream& operator<<(ostream& o, const stack<_Ty>& s) {
  if (s.empty()) {
    o << "{ }";
    return o;
  }
  stack<_Ty> t(s);
  o << "{" << t.top();
  t.pop();
  while (!t.empty()) {
    o << ", " << t.top();
    t.pop();
  }
  o << "}";
  return o;
}
template <typename _Ty>
ostream& operator<<(ostream& o, const list<_Ty>& l) {
  if (l.empty()) {
    o << "{ }";
    return o;
  }
  o << "{" << l.front();
  for (auto itr = ++l.begin(); itr != l.end(); ++itr) {
    o << ", " << *itr;
  }
  o << "}";
  return o;
}
template <typename _KTy, typename _Ty>
istream& operator>>(istream& is, pair<_KTy, _Ty>& m) {
  is >> m.first >> m.second;
  return is;
}
template <typename _Ty>
istream& operator>>(istream& is, vector<_Ty>& v) {
  for (size_t i = 0; i < v.size(); i++) is >> v[i];
  return is;
}
namespace aux {
template <typename Ty, unsigned N, unsigned L>
struct tp {
  static void print(ostream& os, const Ty& v) {
    os << get<N>(v) << ", ";
    tp<Ty, N + 1, L>::print(os, v);
  }
};
template <typename Ty, unsigned N>
struct tp<Ty, N, N> {
  static void print(ostream& os, const Ty& v) { os << get<N>(v); }
};
}  // namespace aux
template <typename... Tys>
ostream& operator<<(ostream& os, const tuple<Tys...>& t) {
  os << "{";
  aux::tp<tuple<Tys...>, 0, sizeof...(Tys) - 1>::print(os, t);
  os << "}";
  return os;
}
template <typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T& val) {
  std::fill((T*)array, (T*)(array + N), val);
}
void dump_func() { cerr << endl; }
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&&... tail) {
  cerr << head;
  if (sizeof...(Tail) == 0) {
    cerr << " ";
  } else {
    cerr << ", ";
  }
  dump_func(std::move(tail)...);
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int N;
  cin >> N;
  vector<long long> X(N);
  cin >> X;
  long long L, Q;
  cin >> L >> Q;
  vector<vector<int>> dp(32, vector<int>(N, 0));
  for (int i = (0); i < (N); ++i) {
    long long x = X[i] + L;
    int idx = upper_bound((X).begin(), (X).end(), x) - X.begin() - 1;
    dp[0][i] = idx;
  }
  for (int k = (0); k < (31); ++k) {
    for (int i = (0); i < (N); ++i) {
      dp[k + 1][i] = dp[k][dp[k][i]];
    }
  }
  for (int q = (0); q < (Q); ++q) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    if (a > b) swap(a, b);
    int ans = 0;
    while (a < b) {
      int k;
      for (k = 0; dp[k][a] <= b; k++)
        ;
      k--;
      a = dp[k][a];
      ans += (1 << k);
    }
    cout << ans << endl;
  }
  return 0;
}
