#include <bits/stdc++.h>
using namespace std;
int N, L, Q;
int x[100010];
int t[100010];
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &x[i]);
  }
  scanf("%d%d", &L, &Q);
  int si = 1, se = 1;
  while (se < N) {
    if (x[se + 1] - x[si] <= L) {
      se++;
    } else {
      t[si] = se;
      si++;
    }
  }
  for (int i = si; i <= N; i++) {
    t[i] = se;
  }
  int a, b, temp, c;
  for (int i = 1; i <= Q; i++) {
    scanf("%d%d", &a, &b);
    if (a > b) {
      temp = a;
      a = b;
      b = temp;
    }
    temp = a;
    c = 0;
    while (temp < b) {
      temp = t[temp];
      c++;
    }
    printf("%d\n", c);
  }
  return 0;
}
