#include <bits/stdc++.h>
using namespace std;
int n, a[100010], L, m;
map<pair<int, int>, int> Map;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  scanf("%d%d", &L, &m);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x > y) swap(x, y);
    int jn, last = x, ans = 0;
    if (Map[{x, y}])
      printf("%d\n", Map[{x, y}]);
    else {
      for (int j = x; j <= y; j++) {
        jn = a[j] - a[last];
        if (jn > L) ans++, j--, last = j;
      }
      Map[{x, y}] = ans + 1;
      printf("%d\n", ans + 1);
    }
  }
  return 0;
}
