#include <bits/stdc++.h>
int min(long long int x, long long int y) {
  if (x < y)
    return x;
  else
    return y;
}
int compare_int(const void *c, const void *d) {
  long long int *C = (long long int *)c;
  long long int *D = (long long int *)d;
  if (*C < *D) return 1;
  if (*C > *D) return -1;
  return 0;
}
int days(int start, int goal, int l, int n, int x[]) {
  int j = start;
  while (x[j] - x[start] <= l) {
    if (j == goal) return 1;
    j++;
  }
  j--;
  return 1 + days(j, goal, l, n, x);
}
int main(void) {
  int n, l, q;
  scanf("%d", &n);
  int x[n + 1];
  for (int i = 0; i < n; i++) {
    scanf("%d", &x[i + 1]);
  }
  scanf("%d %d", &l, &q);
  int a[q], b[q];
  for (int i = 0; i < q; i++) {
    scanf("%d %d", &a[i], &b[i]);
  }
  for (int i = 0; i < q; i++) {
    if (a[i] > b[i]) {
      int t = a[i];
      a[i] = b[i];
      b[i] = t;
    }
    printf("%d\n", days(a[i], b[i], l, n, x));
  }
  return 0;
}
