#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
template <class T>
inline bool chmax(T& x, T y) {
  if (x < y) {
    x = y;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& x, T y) {
  if (x > y) {
    x = y;
    return true;
  }
  return false;
}
struct Doubling {
  vector<vector<int>> table;
  const int ub_log;
  const int n;
  Doubling(int n) : n(n), ub_log(32 - __builtin_clz(n)) {
    table.assign(ub_log, vector<int>(n, -1));
  }
  void set(int cur, int nxt) { table[0][cur] = nxt; }
  void build() {
    for (int k = 0; k + 1 < ub_log; ++k) {
      for (int i = 0; i < n; ++i) {
        if (table[k][i] != -1) table[k + 1][i] = table[k][table[k][i]];
      }
    }
  }
  int query(int a, int b) {
    int res = 0;
    for (int k = ub_log - 1; k >= 0; --k) {
      if (table[k][a] == -1 || table[k][a] > b) continue;
      res += 1 << k;
      if (table[k][a] < b)
        a = table[k][a];
      else
        break;
    }
    return res;
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N, L, Q;
  cin >> N;
  vector<int> x(N);
  for (int i = 0; i < N; ++i) cin >> x[i];
  cin >> L >> Q;
  Doubling table(N);
  for (int i = 0; i < N - 1; ++i) {
    int p = upper_bound(x.begin(), x.end(), x[i] + L) - x.begin();
    table.set(i, p - 1);
  }
  table.build();
  for (int i = 0; i < Q; ++i) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    if (a > b) swap(a, b);
    cout << table.query(a, b) << '\n';
  }
}
