#include <bits/stdc++.h>
using namespace std;
class ETakAndHotels {
 public:
  static constexpr long long kStressIterations = 0;
  static void generateTest(std::ostream& test) {}
  void solve(std::istream& cin, std::ostream& cout) {
    long long N;
    cin >> N;
    vector<long long> x(N);
    for (long long i = 0, i_len = (N); i < i_len; ++i) cin >> x[i];
    long long L, Q;
    cin >> L >> Q;
    vector<vector<long long>> next(N, vector<long long>(51));
    for (long long i = 0, i_len = (N); i < i_len; ++i) {
      long long to = x[i] + L;
      auto itr = upper_bound(x.begin(), x.end(), to);
      itr--;
      next[i][0] = itr - x.begin();
    }
    for (long long j = 0, j_len = (50); j < j_len; ++j) {
      for (long long i = 0, i_len = (N); i < i_len; ++i) {
        long long to = next[i][j];
        next[i][j + 1] = next[to][j];
      }
    }
    while (Q--) {
      long long a, b;
      cin >> a >> b;
      a--, b--;
      if (a > b) swap(a, b);
      long long res = 0;
      long long cur = a;
      for (long long j = (50); j >= (0); --j) {
        if (next[cur][j] <= b) {
          res += 1 << j;
          cur = next[cur][j];
        }
      }
      cout << res << endl;
    }
  }
};
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  ETakAndHotels solver;
  solver.solve(in, out);
  return 0;
}
