#include <bits/stdc++.h>
using namespace std;
int n, l;
int q;
vector<int> x;
int t;
int a, b;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &t);
    x.push_back(t);
  }
  scanf("%d", &l);
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    scanf("%d %d", &a, &b);
    int cur = 0;
    int cnt = 0;
    if (a > b) swap(a, b);
    int start = a - 1;
    for (int j = a; j <= b - 1; j++) {
      if (abs(x[start] - x[j]) <= l) {
        cur = max(cur, abs(x[start] - x[j]));
      }
      if (((j + 1) <= b) && (cur + abs(x[j] - x[j + 1])) > l) {
        cur = 0;
        cnt++;
        start = j;
      }
    }
    printf("%d\n", cnt);
  }
  return 0;
}
