#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 10;
int N, L, Q;
int x[MAX];
int dp[MAX][22];
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> x[i + 1];
  cin >> L >> Q;
  for (int i = 0; i < 20; i++) dp[N][i] = N;
  for (int i = N - 1; i >= 1; i--) {
    int lo = i + 1, hi = N + 1;
    while (hi - lo > 1) {
      int mid = (hi + lo) / 2;
      if (x[mid] - x[i] <= L)
        lo = mid;
      else
        hi = mid;
    }
    dp[i][1] = lo;
    for (int j = 2; j < 20; j++) {
      dp[i][j] = dp[dp[i][j - 1]][j - 1];
    }
  }
  for (int q = 0; q < Q; q++) {
    int a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    int ans = 0;
    while (a < b) {
      for (int i = 1; i < 20; i++) {
        if (dp[a][i] < b) continue;
        if (dp[a][i] == b) {
          ans += 1 << (i - 1);
          a = b;
          break;
        }
        ans += 1 << (i - 2);
        a = dp[a][i - 1];
        break;
      }
    }
    cout << ans << endl;
  }
}
