#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
int n, l, q;
int a[N];
int c[N];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < int(n); i++) scanf("%d", &a[i]);
  c[0] = a[1];
  for (int i = 1; i < int(n); i++) c[i] = a[i] - a[i - 1];
  scanf("%d", &l);
  scanf("%d", &q);
  for (int i = 0; i < int(q); i++) {
    int left, right;
    scanf("%d%d", &left, &right);
    if (left > right) swap(left, right);
    left--;
    int cur = left;
    int res = 0;
    for (int j = left; j < int(right); j++) {
      if (a[j] - a[cur] > l) {
        cur = j - 1;
        res++;
      }
    }
    if (cur != right - 1) res++;
    printf("%d\n", res);
  }
  return 0;
}
