#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  long long x[N];
  for (int i = 0; i < N; i++) cin >> x[i];
  long long L;
  cin >> L;
  long long tmp = 0;
  int y[N];
  int j = 0;
  for (int i = 0; i < N; i++) {
    while (tmp <= x[i] + L) {
      if (j == N - 1) break;
      j++;
      tmp = x[j];
    }
    if (j == N - 1) {
      tmp = x[j];
      y[i] = j;
    } else {
      tmp = x[j - 1];
      j--;
      y[i] = j;
    }
  }
  int dp[30][N];
  for (int i = 0; i < N; i++) {
    dp[0][i] = y[i];
  }
  for (int i = 0; i < 29; i++) {
    for (int j = 0; j < N; j++) {
      dp[i + 1][j] = dp[i][dp[i][j]];
    }
  }
  int Q;
  cin >> Q;
  while (Q--) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    if (b < a) swap(a, b);
    long long ans = 0;
    for (int i = 29; i >= 0; i--) {
      if (dp[i][a] < b) {
        a = dp[i][a];
        ans += (1 << i);
      }
    }
    if (a == b)
      cout << ans << endl;
    else
      cout << ans + 1 << endl;
  }
}
