#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

int N, L, Q;
int X[100000];
int U[19][100000];

int main() {
  cin >> N;
  for (int i=0; i<N; i++) cin >> X[i];
  cin >> L >> Q;
  for (int i=N-1; i>=0; i--) {
    U[0][i] = min((int)(upper_bound(X, X+N, X[i]+L) - X - 1), N-1);
    for (int k=0; k<18; k++) {
      U[k+1][i] = U[k][U[k][i]];
    }
  }
  for (int i=0; i<Q; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    if (a > b) swap(a, b);
    int c = 1;
    for (int k=18; k>=0; k--) {
      if (U[k][a] < b) {
        a = U[k][a];
        c += (1<<k);
      }
    }
    cout << c << "\n";
  }
  return 0;
}
