#include <bits/stdc++.h>
using namespace std;
const int twx = 1e5 + 100;
const int inf = 0x7fffffff;
long long read() {
  long long sum = 0;
  long long flag = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') {
      flag = -1;
    }
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    sum = ((sum * 10) + c - '0');
    c = getchar();
  }
  return sum * flag;
}
int n;
int x[twx];
int L, Q;
int a, b;
int asd[twx][40];
void init() {
  n = read();
  for (int i = 1; i <= n; i++) {
    x[i] = read();
  }
  L = read();
  Q = read();
  for (int i = 1; i <= n; i++) {
    int LEFT = i + 1;
    int RIGHT = n;
    while (LEFT <= RIGHT) {
      int MID = (LEFT + RIGHT) / 2;
      if (x[MID] <= L + x[i]) {
        LEFT = MID + 1;
      } else {
        RIGHT = MID - 1;
      }
    }
    if (x[i] + L >= x[n]) {
      asd[i][0] = n;
    } else {
      asd[i][0] = LEFT - 1;
    }
  }
  for (int i = 1; i <= 30; i++) {
    for (int j = 1; j <= n; j++) {
      asd[j][i] = asd[asd[j][i - 1]][i - 1];
    }
  }
  while (Q--) {
    int a = read();
    int b = read();
    if (b < a) {
      swap(a, b);
    }
    long long ans = 0;
    for (int i = 30; i >= 0; i--) {
      if (asd[a][i] <= b) {
        ans += (1 << i);
        a = asd[a][i];
      }
    }
    printf("%lld\n", ans);
  }
}
int main() {
  init();
  return 0;
}
