#include <bits/stdc++.h>
using namespace std;
using i32 = int;
using i64 = long long;
using f64 = double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf64 = vector<f64>;
using vstr = vector<string>;
template <typename T, typename S>
void amax(T &x, S y) {
  if (x < y) x = y;
}
template <typename T, typename S>
void amin(T &x, S y) {
  if (y < x) x = y;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  int n;
  cin >> n;
  vi64 x(n + 1);
  for (int i = 0; i < int(n); i++) cin >> x[i];
  x[n] = 1e18;
  int l, q;
  cin >> l >> q;
  if (n > 1000 || q > 1000) return 0;
  for (int _ = 0; _ < int(q); _++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    if (a > b) swap(a, b);
    int ans = 0;
    int now = a;
    while (now < b) {
      int ok = now, ng = n;
      while (ng - ok > 1) {
        int md = (ok + ng) / 2;
        if (x[md] <= x[now] + l)
          ok = md;
        else
          ng = md;
      }
      ans++;
      now = ok;
    }
    cout << ans << endl;
  }
  return 0;
}
