#include <bits/stdc++.h>
using namespace std;
int tab[20][100000];
bool C(int a, int b, int mid) {
  int pos = a;
  int cnt = 0;
  while (mid != 0) {
    if (mid & 1) {
      pos = tab[cnt][pos];
    }
    mid >>= 1;
    cnt++;
  }
  if (pos >= b)
    return true;
  else
    return false;
}
int solve(int a, int b) {
  if (a > b) swap(a, b);
  int ub = 100000;
  int lb = 0;
  while (ub - lb > 1) {
    int mid = lb + (ub - lb) / 2;
    if (C(a, b, mid))
      ub = mid;
    else
      lb = mid;
  }
  return ub;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, L, Q;
  int x[100000];
  cin >> N;
  for (int i = 0; i < N; i++) cin >> x[i];
  cin >> L >> Q;
  for (int i = 0; i < N; i++) {
    tab[0][i] = upper_bound(x, x + N, x[i] + L) - x - 1;
  }
  for (int k = 0; k < 20; k++) {
    for (int i = 0; i < N; i++) {
      tab[k + 1][i] = tab[k][min(N - 1, tab[k][i])];
    }
  }
  for (int i = 0; i < Q; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    cout << solve(a, b) << endl;
  }
  return 0;
}
