#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long IINF = 1e18;
const double EPS = 1e-8;
const double pi = acos(-1);
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
const long long LOG_N = 20;
int main() {
  long long N;
  cin >> N;
  vector<long long> x(N);
  for (long long i = 0; i < N; ++i) cin >> x[i];
  long long L, Q;
  cin >> L >> Q;
  vector<vector<long long>> next(LOG_N, vector<long long>(N, -1));
  for (long long i = 0; i < N; ++i) {
    long long y = upper_bound(x.begin(), x.end(), x[i] + L) - x.begin() - 1;
    next[0][i] = y;
  }
  for (long long i = 0; i < LOG_N - 1; ++i) {
    for (long long j = 0; j < N; ++j) {
      if (next[i][j] == -1)
        continue;
      else
        next[i + 1][j] = next[i][next[i][j]];
    }
  }
  for (long long i = 0; i < Q; ++i) {
    long long a, b, ans = 0;
    cin >> a >> b;
    if (a > b) swap(a, b);
    --a, --b;
    bool ok = false;
    while (!ok) {
      for (long long i = 0; i < LOG_N; ++i) {
        if (next[i][a] > b) {
          if (i == 0) {
            ans += 1;
            ok = true;
            break;
          }
          ans += 1 << (i - 1);
          a = next[i - 1][a];
          break;
        } else if (next[i][a] == b) {
          ans += 1 << i;
          ok = true;
          break;
        }
      }
    }
    cout << ans << endl;
  }
}
