#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l, q, a, b;
  cin >> n;
  long long x[100005];
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  cin >> l >> q;
  int upper, lower, mid;
  int next[100005];
  for (int i = 0; i < n - 1; i++) {
    upper = n - 1;
    lower = i;
    while (upper - lower > 1) {
      mid = (upper + lower) / 2;
      if (x[mid] - x[i] > l) {
        upper = mid;
      } else {
        lower = mid;
      }
    }
    next[i] = upper;
  }
  for (int i = 0; i < q; i++) {
    cin >> a >> b;
    if (a > b) {
      int c = a;
      a = b;
      b = c;
    }
    int day = 0;
    while (true) {
      day++;
      a = next[a - 1];
      if (a >= b) {
        break;
      }
    }
    cout << day << endl;
  }
  return 0;
}
