#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
int main() {
  long long n;
  cin >> n;
  vector<long long> x(n + 1);
  for (int i = 0; i < n; ++i) scanf("%d", &x[i]);
  x[n] = INF;
  long long l, q;
  cin >> l >> q;
  vector<vector<long long>> dub(20, vector<long long>(n, 0));
  long long st = 0, en = 1;
  for (long long i = 0; i < (long long)(n - 1); i++) {
    while (x[en + 1] - x[i] <= l) en++;
    dub[0][i] = en;
  }
  dub[0][n - 1] = -1;
  long long dep;
  for (long long i = 0; i < (long long)(19); i++) {
    for (long long j = 0; j < (long long)(n); j++) {
      if (dub[i][j] == -1)
        dub[i + 1][j] = -1;
      else
        dub[i + 1][j] = dub[i][dub[i][j]];
    }
    if (dub[i + 1][0] == -1) {
      dep = i;
      break;
    }
  }
  for (long long ii = 0; ii < (long long)(q); ii++) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    if (a > b) swap(a, b);
    long long ans = 0;
    for (long long i = dep; i >= 0; i--) {
      if (0 < x[dub[i][a]] && x[dub[i][a]] < x[b]) {
        ans += 1LL << i;
        a = dub[i][a];
      }
    }
    cout << ans + 1 << endl;
  }
  return 0;
}
