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