#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<vector<int>> hotels(2, vector<int>(N));
  for (int i = 0; i < (int)(N); i++) cin >> hotels[0][i];
  for (int i = 0; i < (int)(N); i++)
    hotels[1][i] = hotels[0][N - 1] - hotels[0][N - 1 - 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>> next_hotel(2, vector<int>(N));
  for (int k = 0; k < (int)(2); k++)
    for (int i = 0; i < (int)(N); i++) {
      next_hotel[k][i] =
          upper_bound(hotels[k].begin(), hotels[k].end(), hotels[k][i] + L) -
          hotels[k].begin() - 1;
    }
  vector<vector<vector<int>>> doubling(
      2, vector<vector<int>>(21, 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)(21 - 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];
    if (a > b) {
      a = N - 1 - a;
      b = N - 1 - b;
    }
    assert(a < b);
    int low = 0, high = 1e6;
    while (low + 1 < high) {
      int mid = (low + high) >> 1, now = a;
      for (int i = 21 - 1; i >= 0; i--)
        if (mid >> i & 1) now = doubling[k][i][now];
      (now >= b ? high : low) = mid;
    }
    cout << high << endl;
  }
  return 0;
}
