#include <bits/stdc++.h>
using namespace std;
int N, Q;
long L;
int** child;
void init(int n) {
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < N; j++) {
      if (j + child[i][j] < N)
        child[i + 1][j] = child[i][j] + child[i][j + child[i][j]];
    }
  }
}
int main() {
  cin >> N;
  vector<long> x(N);
  for (int i = 0; i < N; i++) {
    long xin;
    cin >> xin;
    x[i] = xin;
  }
  cin >> L >> Q;
  long y = (x[N - 1] - x[0]) / L + 1L;
  int n = 0;
  while (y > 0L) {
    n++;
    y /= 2L;
  }
  child = new int*[n];
  for (int i = 0; i < n; i++) {
    child[i] = new int[N];
  }
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < N; j++) {
      child[i][j] = 100005;
    }
  }
  for (int i = 0; i < N; i++) {
    int d;
    auto ir = upper_bound(x.begin(), x.end(), x.at(i) + L);
    if (ir == x.begin())
      d = 1000005;
    else {
      ir--;
      d = distance(x.begin(), ir) - i;
    }
    child[0][i] = d;
  }
  init(n);
  for (int i = 0; i < Q; i++) {
    int result = 0;
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    if (a > b) swap(a, b);
    for (int j = n - 1; j >= 0; j--) {
      if (b - a >= child[j][a]) {
        result += pow(2, j);
        a = a + child[j][a];
      }
    }
    cout << result << endl;
  }
}
