#include <bits/stdc++.h>
using namespace std;
using Int = long;
const int N_MAX = 100005;
const int LOG_N_MAX = 17;
const Int L_MAX = 1000000005;
Int xs[N_MAX];
int dbl[LOG_N_MAX + 1][N_MAX];
int getDay(int a, const int b) {
  int day = 0;
  while (a < b) {
    int i = 0;
    while (dbl[i + 1][a] < b) i++;
    a = dbl[i][a];
    day += (1 << i);
  }
  return day;
}
void solve() {
  int N, Q;
  Int L;
  cin >> N;
  for (int i = (0); i < (N); i++) cin >> xs[i];
  xs[N] = L_MAX;
  cin >> L;
  {
    int i = 0, j = 0;
    while (j < N) {
      while (xs[j + 1] - xs[i] <= L) j++;
      dbl[0][i] = j;
      i++;
    }
  }
  for (int s = 1; (1 << s) <= N; s++) {
    for (int i = (0); i < (N); i++) {
      dbl[s][i] = dbl[s - 1][dbl[s - 1][i]];
    }
  }
  cin >> Q;
  for (int q = (0); q < (Q); q++) {
    int a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    cout << getDay(a - 1, b - 1) << endl;
  }
}
int main() {
  solve();
  return 0;
}
