#include <bits/stdc++.h>
using namespace std;
void debug_out() { cerr << ' '; }
template <typename t1, typename... t2>
void debug_out(t1 A, t2... B) {
  cerr << " " << A;
  debug_out(B...);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  vector<int> ans(n);
  int l, q;
  cin >> l >> q;
  int left = 0, right = 0;
  while (left < n && right < n) {
    if (a[right] - a[left] <= l) {
      ++right;
    } else {
      ans[left] = right - 1;
      ++left;
    }
  }
  for (int i = 0; i < n; ++i)
    if (!ans[i]) ans[i] = n - 1;
  while (q--) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    if (v < u) swap(u, v);
    if (ans[u] >= v)
      cout << 1 << '\n';
    else {
      int cnt = 0;
      while (u < v) {
        u = ans[u];
        ++cnt;
      }
      cout << cnt << '\n';
    }
  }
  return 0;
}
