#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l, q;
  cin >> n;
  vector<int> x(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  cin >> l >> q;
  if (n > 1000 || q > 1000) {
    return 0;
  }
  int a, b;
  vector<long long> ans(q, 0);
  for (int i = 0; i < q; i++) {
    cin >> a >> b;
    a--;
    b--;
    if (a > b) {
      swap(a, b);
    }
    long long days = 1;
    int from = a;
    int to = from;
    while (to < b) {
      if (x[to] - x[from] <= l) {
        to++;
      } else {
        days++;
        from = to - 1;
      }
    }
    if (x[to] - x[from] > l) {
      days++;
    }
    ans[i] = days;
  }
  for (auto e : ans) {
    cout << e << endl;
  }
  return 0;
}
