#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, L, Q, a, b, tmp, day;
  int s, t;
  vector<int> v;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    v.push_back(x);
  }
  cin >> L >> Q;
  for (int i = 0; i < Q; i++) {
    cin >> a >> b;
    if (a > b) {
      tmp = a;
      a = b;
      b = tmp;
    }
    s = a;
    t = a;
    day = 0;
    while (t < b) {
      while (1) {
        if (v[t - 1] - v[s - 1] <= L && t <= b) {
          t += 1;
        } else {
          t -= 1;
          break;
        }
      }
      day += 1;
      s = t;
    }
    cout << day << endl;
  }
  return 0;
}
