#include <bits/stdc++.h>
using namespace std;
long long n, rmq[200005][25], x[200005], l, q;
signed main() {
  queue<pair<long long, long long> > que;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> x[i];
  }
  cin >> l >> q;
  for (long long j = 0; j <= 20; j++) {
    for (long long i = 1; i <= n; i++) {
      rmq[i][j] = 200003;
    }
  }
  long long cnt = 0;
  while (1) {
    if (cnt == n) break;
    cnt++;
    que.push(pair<long long, long long>(x[cnt], cnt));
    while (1) {
      if (x[cnt] - que.front().first > l) {
        rmq[que.front().second][0] = cnt - 1;
        que.pop();
      } else
        break;
    }
  }
  while (!que.empty()) {
    rmq[que.front().second][0] = n;
    que.pop();
  }
  rmq[n][0] = 200003;
  for (long long j = 1; (1 << j) <= n; j++) {
    for (long long i = 1; i + (1 << j) < n; i++) {
      if (rmq[i][j - 1] != n || rmq[i][j - 1] != 200003)
        rmq[i][j] = rmq[rmq[i][j - 1]][j - 1];
    }
  }
  while (q--) {
    long long u, v, res = 0;
    cin >> u >> v;
    if (u > v) swap(u, v);
    for (long long i = 20; i >= 0; i--) {
      if (rmq[u][i] < v) {
        res += (1 << i);
        u = rmq[u][i];
      }
    }
    if (u < v) res++;
    cout << res << "\n";
  }
}
