#include <bits/stdc++.h>
using namespace std;
const int64_t inf = 1LL << 60;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64_t N, L, Q;
  cin >> N;
  vector<int64_t> x(N + 1);
  x[N] = inf;
  for (int64_t i = 0; i < N; i++) cin >> x[i];
  cin >> L >> Q;
  vector<int64_t> a(Q), b(Q);
  for (int64_t i = 0; i < Q; i++) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
  }
  vector<vector<int64_t>> dpi(20, vector<int64_t>(N, 0)),
      dpd(20, vector<int64_t>(N, 0));
  for (int64_t i = 0; i < N; i++) {
    dpi[0][i] = upper_bound(x.begin(), x.end(), x[i] + L) - x.begin() - i - 1;
  }
  for (int64_t i = 0; i < 19; i++) {
    for (int64_t j = 0; j < N; j++) {
      dpi[i + 1][j] = dpi[i][j] + dpi[i][j + dpi[i][j]];
    }
  }
  for (int64_t i = 0; i < Q; i++) {
    if (a[i] > b[i]) swap(a[i], b[i]);
    int64_t ng = 0, ok = 1e5 + 10;
    while (ok - ng > 1) {
      int64_t mid = (ok + ng) / 2;
      int64_t walk = 0;
      for (int64_t j = 0; j < 20; j++) {
        if (mid & (1 << j)) {
          walk += dpi[j][a[i]];
        }
      }
      if (walk >= b[i] - a[i])
        ok = mid;
      else
        ng = mid;
    }
    cout << ok << "\n";
  }
}
