#include <bits/stdc++.h>
using namespace std;
template <typename T>
void readv(vector<T> &a) {
  for (long long i = (0); i < (a.size()); i++) cin >> a[i];
}
void readi(vector<long long> &a) {
  for (long long i = (0); i < (a.size()); i++) {
    cin >> a[i];
    a[i]--;
  }
}
signed main() {
  long long N;
  cin >> N;
  vector<long long> x(N);
  readv(x);
  long long L, Q;
  cin >> L >> Q;
  vector<long long> a(Q), b(Q);
  for (long long i = (0); i < (Q); i++) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
  }
  vector<vector<long long> > m(N, vector<long long>(20, 1000000000000000000));
  for (long long i = (0); i < (N); i++)
    m[i][0] =
        distance(x.begin(), upper_bound(x.begin(), x.end(), x[i] + L)) - 1;
  long long n = 0;
  while (m[0][n] < N - 1) {
    for (long long i = (0); i < (N); i++) m[i][n + 1] = m[m[i][n]][n];
    n++;
  }
  for (long long i = (0); i < (Q); i++) {
    long long a0 = min(a[i], b[i]), b0 = max(a[i], b[i]);
    long long ans = 0, y = a0;
    while (y < b0) {
      long long n =
          distance(m[y].begin(), upper_bound(m[y].begin(), m[y].end(), b0)) - 1;
      y = m[y][n];
      ans += (1 << n);
    }
    cout << ans << endl;
  }
  return 0;
}
