#include <bits/stdc++.h>
using namespace std;
long long dp[18][100000];
long long powd[18];
bool can(long long mid, long long pos, long long a) {
  long long submi = mid;
  long long cango = a;
  while (submi) {
    long long flag = 0;
    while (submi >= powd[flag]) {
      ++flag;
    }
    --flag;
    cango = dp[flag][cango];
    submi -= powd[flag];
  }
  return cango >= pos;
}
int main() {
  for (int i = 0; i < 18; ++i) powd[i] = pow(2, i);
  long long n;
  cin >> n;
  long long x[n];
  for (long long i = 0; i < n; ++i) {
    cin >> x[i];
    for (long long j = 0; j < 18; ++j) {
      dp[j][i] = 0;
    }
  }
  long long l, q;
  cin >> l >> q;
  for (long long i = 0; i < n; ++i) {
    long long upper = n - 1;
    long long lower = 0;
    while (upper - lower > 1) {
      long long mid = (upper + lower) / 2;
      if (x[mid] - x[i] <= l)
        lower = mid;
      else
        upper = mid;
    }
    dp[0][i] = (x[upper] - x[i] <= l ? upper : lower);
  }
  for (long long i = 1; i < 18; ++i) {
    for (long long j = 0; j < n; ++j) dp[i][j] = dp[i - 1][dp[i - 1][j]];
  }
  for (long long que = 0; que < q; ++que) {
    long long a, b;
    cin >> a >> b;
    --a;
    --b;
    if (a > b) a ^= b ^= a ^= b;
    long long lower = 0;
    long long upper = n - 2;
    while (upper - lower > 1) {
      long long mid = (upper + lower) / 2;
      if (can(mid, b, a))
        upper = mid;
      else
        lower = mid;
    }
    cout << (can(lower, b, a) ? lower : upper) << endl;
  }
  return 0;
}
