#include <bits/stdc++.h>
using namespace std;
long long x[100005];
long long n, q;
long long L;
long long dp[100005][21];
bool check(long long from, long long to, long long steps) {
  for (long long i = 0; i <= 20; i++) {
    if (steps & (1LL << i)) {
      from = dp[from][i];
    }
  }
  if (from == 0) return true;
  if (from >= to) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> x[i];
  cin >> L >> q;
  for (long long i = n - 1; i >= 1; i--) {
    auto id = lower_bound(x + 1, x + n + 1, x[i] + L);
    if (id == (x + n + 1)) {
      id--;
    }
    if (x[i] + L != *(id)) {
      id--;
    }
    dp[i][0] = id - x;
    for (long long j = 1; j <= 20; j++) {
      dp[i][j] = dp[dp[i][j - 1]][j - 1];
    }
  }
  while (q--) {
    long long a, b;
    cin >> a >> b;
    long long ans = -1;
    if (a > b) swap(a, b);
    long long hi = n;
    long long lo = 0;
    while (hi > lo) {
      long long mid = lo + (hi - lo) / 2;
      if (check(a, b, mid)) {
        hi = mid;
        ans = mid;
      } else {
        lo = mid + 1;
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
