#include <bits/stdc++.h>
using namespace std;
using vi = vector<long long>;
using pii = pair<long long, long long>;
using vpii = vector<pii>;
using ll = long long;
constexpr long long TEN(long long n) { return n == 0 ? 1 : 10 * TEN(n - 1); }
template <typename T>
bool chmin(T& a, T b) {
  return a > b ? (a = b, 1) : 0;
}
template <typename T>
bool chmax(T& a, T b) {
  return a < b ? (a = b, 1) : 0;
}
long long read() {
  long long a;
  scanf("%lld", &a);
  return a;
}
const double pi = acos(-1);
constexpr long long inf = 3 * TEN(18) + 10;
constexpr long long mod = TEN(9) + 7;
long long N, L, Q;
long long to[100010][25];
signed main() {
  cin >> N;
  vi x(N);
  for (long long i = 0; i < (long long)(N); ++i) cin >> x[i];
  cin >> L >> Q;
  for (long long i = 0; i < (long long)(N); ++i)
    for (long long j = 0; j < (long long)(20); ++j) to[i][j] = N + 1;
  for (long long i = 0; i < (long long)(N); ++i) {
    long long idx = upper_bound(begin(x), end(x), x[i] + L) - begin(x) - 1;
    to[i][0] = idx;
  }
  for (long long j = 1; j < (long long)(4); ++j) {
    for (long long i = 0; i < (long long)(N); ++i) {
      to[i][j] = to[to[i][j - 1]][j - 1];
    }
  }
  for (long long _ = 0; _ < (long long)(Q); ++_) {
    long long a, b;
    cin >> a >> b;
    --a, --b;
    if (a > b) swap(a, b);
    long long ans = 0;
    long long cur = a;
    for (long long i = (long long)(20) - 1; i >= 0; --i) {
      if (b > to[cur][i]) {
        cur = to[cur][i];
        ans += 1ll << i;
      }
    }
    ans++;
    printf("%lld\n", ans);
  }
}
