#include <bits/stdc++.h>
using namespace std;
int dp[18][100000];
int main() {
  long long n;
  cin >> n;
  long long x[n];
  long long sum = 0;
  for (int i = 0; i < n; ++i) {
    cin >> x[i];
    for (int j = 0; j < 18; ++j) {
      dp[j][i] = 0;
    }
  }
  long long l, q;
  cin >> l >> q;
  for (int 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 (int i = 1; i < 18; ++i) {
    for (int j = 0; j < n; ++j) dp[i][j] = dp[i - 1][dp[i - 1][j]];
  }
  for (int 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 = 17;
    long long ans = 0;
    while (1) {
      while (upper - lower > 1) {
        long long mid = (upper + lower) / 2;
        if (dp[mid][a] >= b)
          upper = mid;
        else
          lower = mid;
      }
      if (dp[upper][a] == b) {
        ans += (1 << upper);
        break;
      } else if (dp[lower][a] == b) {
        ans += (1 << lower);
        break;
      } else {
        long long use = (dp[a][upper] < b ? upper : lower);
        ans += (1 << use);
        a = dp[use][a];
        upper = 17;
        lower = 0;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
