#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using stkll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll N;
  cin >> N;
  vll x(N);
  for (ll i = 0; i < (N); i++) cin >> x[i];
  ll L, Q;
  cin >> L >> Q;
  vll dist(N, 0);
  ll left = 0, right = 0, d = 1;
  while (right <= N) {
    if (x[right] - x[left] <= L && right < N)
      right++;
    else {
      for (ll i = left + 1; i < right; i++) dist[i] = d;
      left = right - 1;
      d++;
      if (right >= N) break;
    }
  }
  for (ll i = 0; i < (Q); i++) {
    ll a, b;
    cin >> a >> b;
    a--, b--;
    cout << max(abs(dist[a] - dist[b]), 1LL) << endl;
  }
}
