#include <bits/stdc++.h>
using namespace std;
template <class T = int>
using V = vector<T>;
template <class T = int>
using VV = V<V<T> >;
long long n, L, x[100010], d[100010][18], Q;
void init() {
  cin >> n;
  for (long long i = 0; i < ((long long)(n)); i++) cin >> x[i];
  cin >> L >> Q;
}
int main(void) {
  init();
  int curpos = 0;
  for (long long i = 0; i < ((long long)(n)); i++) {
    while (x[curpos + 1] - x[i] <= L && curpos + 1 < n) curpos++;
    d[i][0] = curpos;
  }
  for (long long j = ((long long)(1)); j <= ((long long)(17)); j++)
    for (long long i = 0; i < ((long long)(n)); i++)
      d[i][j] = d[d[i][j - 1]][j - 1];
  for (long long i = 0; i < ((long long)(Q)); i++) {
    long long a, b, ans = 0;
    cin >> a >> b;
    a--;
    b--;
    if (a > b) swap(a, b);
    int cpos = a;
    for (long long j = ((long long)(18) - 1); j >= 0; j--) {
      if (cpos >= b) break;
      if (j == 0) {
        cpos = d[cpos][0];
        ans++;
        break;
      }
      if (d[cpos][j] >= b && d[cpos][j - 1] < b) {
        cpos = d[cpos][j];
        ans += 1 << j;
      }
    }
  }
  return 0;
}
