#include <bits/stdc++.h>
using namespace std;
int N;
long long x[100001];
long long L;
int Q;
long long a[100001];
long long b[100001];
vector<int> G[100011];
int root;
int parent[21][100011];
int depth[100011];
void dfs(int v, int p, int d) {
  parent[0][v] = p;
  depth[v] = d;
  for (int i = 0; i < (G[v].size()); i++) {
    if (G[v][i] != p) dfs(G[v][i], v, d + 1);
  }
}
void init(int V) {
  dfs(root, -1, 0);
  for (int k = 0; k < (19); k++) {
    for (int v = 0; v < (V); v++) {
      if (parent[k][v] < 0)
        parent[k + 1][v] = -1;
      else
        parent[k + 1][v] = parent[k][parent[k][v]];
    }
  }
}
int main() {
  cin >> N;
  for (int i = 0; i < (N); i++) {
    cin >> x[i];
  }
  cin >> L >> Q;
  for (int i = 0; i < (Q); i++) {
    cin >> a[i] >> b[i];
    if (a[i] > b[i]) swap(a[i], b[i]);
    a[i]--;
    b[i]--;
  }
  int now = 0;
  for (int i = 0; i < (N); i++) {
    while (1) {
      if (now == N) break;
      if (x[now] - x[i] <= L) {
        now++;
      } else {
        break;
      }
    }
    G[now - 1].push_back(i);
  }
  root = N - 1;
  init(N);
  long long d = 1;
  for (int i = 0; i < (20); i++) {
    d *= 2;
  }
  for (int i = 0; i < (Q); i++) {
    long long c = 0;
    long long e = d;
    int cc = a[i];
    for (int j = 20; j >= 0; j--) {
      if (parent[j][cc] <= b[i] && parent[j][cc] > 0) {
        cc = parent[j][cc];
        c += e;
      }
      e /= 2;
    }
    if (cc != b[i]) {
      c++;
    }
    cout << c << endl;
  }
  return 0;
}
