#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n, q, l;
  cin >> n;
  vector<long long> x(n);
  for (int i = 0; i < (int)(n); ++i) cin >> x[i];
  cin >> l >> q;
  vector<pair<long long, long long> > ab(q);
  for (int i = 0; i < (int)(q); ++i) {
    cin >> ab[i].first >> ab[i].second;
    ab[i].first--;
    ab[i].second--;
    if (ab[i].first > ab[i].second) {
      long long tmp = ab[i].first;
      ab[i].first = ab[i].second;
      ab[i].second = tmp;
    }
  }
  for (pair<long long, long long> p : ab) {
    long long cur = p.first, days = 0;
    while (cur != p.second) {
      long long i;
      for (i = cur; i < p.second; i++)
        if (x[i] - x[cur] > l) break;
      if (x[i] - x[cur] > l) i--;
      cur = i;
      days++;
    }
    cout << days << endl;
  }
  return 0;
}
