#include <bits/stdc++.h>
using namespace std;
int n, q, l, a[111111], x, y, pos, pre, cnt;
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);
    if (x > y) swap(x, y);
    pos = x;
    cnt = 0;
    while (pos < y) {
      pre = pos;
      while (pos <= y && a[pos] - a[pre] <= l) pos++;
      pos--;
      cnt++;
    }
    printf("%d\n", cnt);
  }
  return 0;
}
