#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int INFINT = INT_MAX / 2;
int dp[40][100000];
void makeDoubling(vector<unsigned long long> &xs, unsigned long long L) {
  int N = xs.size();
  for (int i = 0; i < N; i++) {
    dp[0][i] =
        lower_bound(xs.begin(), xs.end(), xs[i] + L + 1) - xs.begin() - 1;
  }
  for (int i = 1; i < 40; i++) {
    for (int j = 0; j < N; j++) {
      dp[i][j] = dp[i - 1][dp[i - 1][j]];
    }
  }
  return;
}
int MinimumDays(int a, int b) {
  if (a > b) swap(a, b);
  int now = a;
  int res = 0;
  for (int i = 40; i >= 0; i--) {
    if (dp[i][now] < b) {
      now = dp[i][now];
      res += 1 << i;
    }
  }
  res++;
  return res;
}
int main() {
  int N, x;
  cin >> N;
  vector<unsigned long long> xs(N);
  for (int i = 0; i < N; i++) {
    cin >> x;
    xs[i] = x;
  }
  unsigned long long L;
  int Q, a, b;
  cin >> L >> Q;
  makeDoubling(xs, L);
  for (int i = 0; i < Q; i++) {
    cin >> a >> b;
    cout << MinimumDays(a - 1, b - 1) << endl;
  }
  return 0;
}
