#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
using V = vector<T>;
template <class T, class U>
using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  V<int> x(n);
  for (ll i = 0; i < (ll)n; ++i) cin >> x[i];
  int l, q;
  cin >> l >> q;
  V<V<int> > doubling(n, V<int>(31, 0));
  int j;
  for (int i = 0; i < n; i++) {
    j = 0;
    while (j < n && x[j] - x[i] <= l) j++;
    doubling[i][0] = j - 1;
  }
  for (int j = 0; j < 30; j++) {
    for (int i = 0; i < n; i++) {
      doubling[i][j + 1] = doubling[doubling[i][j]][j];
    }
  }
  for (int _q = 0; _q < q; _q++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    if (a > b) swap(a, b);
    int ans = 0;
    for (int i = 30; i >= 0; i--) {
      if (doubling[a][i] < b) {
        ans += 1 << i;
        a = doubling[a][i];
      }
    }
    cout << ans + 1 << '\n';
  }
  return 0;
}
