#include <bits/stdc++.h>
using namespace std;
int x[100050];
int main() {
  int n, q, l;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &x[i]);
  scanf("%d", &l);
  scanf("%d", &q);
  while (q--) {
    int a, b;
    scanf("%d%d", &a, &b);
    if (a > b) swap(a, b);
    int ans = 1;
    int pre = x[a];
    for (int i = a + 1; i <= b; ++i) {
      if (x[i] - pre > l) {
        ++ans;
        pre = x[i - 1];
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
