#include <bits/stdc++.h>
using namespace std;
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> hotels(N);
  for (int i = 0; i < (int)(N); i++) cin >> hotels[i];
  int L, Q;
  cin >> L >> Q;
  vector<int> A(Q), B(Q);
  for (int i = 0; i < (int)(Q); i++) cin >> A[i] >> B[i], A[i]--, B[i]--;
  vector<vector<int>> left(2, vector<int>(N)), next_hotel(2, vector<int>(N));
  for (int i = 0; i < (int)(N); i++) left[0][i] = hotels[i] - hotels[0];
  for (int i = N - 1; i >= 0; i--)
    left[1][N - 1 - i] = hotels[N - 1] - hotels[i];
  for (int k = 0; k < (int)(2); k++)
    for (int i = 0; i < (int)(N); i++) {
      auto c = lower_bound(left[k].begin(), left[k].end(), left[k][i] + L);
      if (c == left[k].end()) {
        next_hotel[k][i] = N - 1;
      } else {
        int idx = c - left[k].begin();
        next_hotel[k][i] = left[k][idx] > left[k][i] + L ? idx - 1 : idx;
      }
    }
  next_hotel[0][N - 1] = next_hotel[1][N - 1] = -1;
  vector<vector<vector<int>>> doubling(
      2, vector<vector<int>>(18, vector<int>(N, -1)));
  for (int k = 0; k < (int)(2); k++)
    for (int i = 0; i < (int)(N); i++) doubling[k][0][i] = next_hotel[k][i];
  for (int k = 0; k < (int)(2); k++)
    for (int i = 0; i < (int)(18 - 1); i++)
      for (int j = 0; j < (int)(N); j++)
        doubling[k][i + 1][j] =
            doubling[k][i][j] < 0 ? -1 : doubling[k][i][doubling[k][i][j]];
  for (int q = 0; q < (int)(Q); q++) {
    int k = A[q] > B[q], a = A[q], b = B[q];
    swap(a, b);
    if (a > b) {
      a = N - 1 - a;
      b = N - 1 - b;
    }
    assert(a < b);
    int ans = 0;
    for (int i = 18 - 1; i >= 0; i--) {
      if (doubling[k][i][a] != -1 and doubling[k][i][a] < b) {
        ans += 1 << i;
        a = doubling[k][i][a];
      }
    }
    printf("%d\n", ans + 1);
  }
  return 0;
}
