#include <bits/stdc++.h>
using namespace std;
int main() {
  long l;
  long x[500010];
  int n, q, i, j, k, total, a, b;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%ld", &x[i]);
  }
  x[n] = 1100000000;
  scanf("%ld", &l);
  scanf("%d", &q);
  for (i = 0; i < q; i++) {
    total = 0;
    scanf("%d %d", &a, &b);
    int temp;
    if (a > b) {
      temp = a;
      a = b;
      b = temp;
    }
    if (x[b - 1] - x[a - 1] <= l) {
      printf("1");
      return 0;
    }
    j = a - 1;
    for (k = j + 1; k < b; k++) {
      if ((x[k] - x[j] <= l) && (x[k + 1] - x[j] > l)) {
        total = total + 1;
        j = k;
      }
    }
    if (x[b] - x[j] < l && b - j != 1) {
      total++;
    }
    printf("%d\n", total);
  }
  return 0;
}
