#include <bits/stdc++.h>
using namespace std;
const int N_MAX = 100000;
const int Q_MAX = 100000;
const int LOGN_MAX = 17;
int N;
int x[N_MAX];
int L;
int Q;
int a[Q_MAX];
int b[Q_MAX];
int nxt[LOGN_MAX][N_MAX];
void solve() {
  int t = 0;
  for (int f = 0; f < (int)(N); f++) {
    nxt[0][f] = t - 1;
    while (t < N && x[t] - x[f] <= L) {
      nxt[0][f] = t++;
    }
  }
  nxt[0][N - 1] = N;
  for (int k = 0; k < (int)(LOGN_MAX - 1); k++) {
    for (int i = 0; i < (int)(N); i++) {
      int j = nxt[k][i];
      nxt[k + 1][i] = nxt[k][j] > j ? nxt[k][j] : N;
    }
  }
  for (int i = 0; i < (int)(Q); i++) {
    int f = a[i];
    int t = b[i];
    int d = 0;
    for (int k = LOGN_MAX - 1; k >= 0; k--) {
      if (nxt[k][f] <= t) {
        d |= 1 << k;
        f = t;
      }
    }
    printf("%d\n", d);
  }
}
void input() {
  scanf("%d", &N);
  for (int i = 0; i < (int)(N); i++) scanf("%d", x + i);
  scanf("%d", &L);
  scanf("%d", &Q);
  for (int i = 0; i < (int)(Q); i++) {
    scanf("%d%d", a + i, b + i);
    --a[i];
    --b[i];
    if (a[i] > b[i]) swap(a[i], b[i]);
  }
}
int main() {
  input();
  solve();
  return 0;
}
