#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = (ll)1e18;
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-9;
constexpr ll dx[4] = {1LL, 0LL, -1LL, 0LL};
constexpr ll dy[4] = {0LL, 1LL, 0LL, -1LL};
constexpr ll dx8[8] = {1LL, 0LL, -1LL, 0LL, 1LL, 1LL, -1LL, -1LL};
constexpr ll dy8[8] = {0LL, 1LL, 0LL, -1LL, 1LL, -1LL, 1LL, -1LL};
void p() { std::cout << '\n'; }
template <typename Head, typename... Tail>
void p(Head head, Tail... tail) {
  std::cout << head << (sizeof...(tail) ? " " : "");
  p(tail...);
}
template <typename T>
inline void pv(std::vector<T>& v) {
  for (ll i = 0, N = v.size(); i < N; i++)
    std::cout << v[i] << " \n"[i == N - 1];
}
template <typename T>
inline T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
inline T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <typename T>
inline bool chmax(T& a, T b) {
  return a < b && (a = b, true);
}
template <typename T>
inline bool chmin(T& a, T b) {
  return a > b && (a = b, true);
}
template <typename T>
inline void uniq(std::vector<T>& v) {
  v.erase(unique(v.begin(), v.end()), v.end());
}
class Doubling {
 public:
  const ll LOG;
  vector<vector<ll> > table;
  Doubling(ll sz, ll lim_t) : LOG(64 - __builtin_clzll(lim_t)) {
    table.assign(LOG, vector<ll>(sz, -1));
  }
  void set_next(ll k, ll x) { table[0][k] = x; }
  void build() {
    for (ll k = 0; k + 1 < LOG; k++) {
      for (ll i = 0, size = table[k].size(); i < size; i++) {
        if (table[k][i] == -1)
          table[k + 1][i] = -1;
        else
          table[k + 1][i] = table[k][table[k][i]];
      }
    }
  }
  ll query(ll k, ll t) {
    for (ll i = LOG - 1; i >= 0; i--) {
      if ((t >> i) & 1) k = table[i][k];
    }
    return k;
  }
};
void solve() {
  ll N;
  cin >> N;
  vector<ll> x(N, 0);
  for (ll i = 0, i_length = (N); i < i_length; ++i) cin >> x[i];
  ll L, Q;
  cin >> L >> Q;
  Doubling doubling(N, N);
  for (ll i = 0, i_length = (N); i < i_length; ++i) {
    ll t = 0;
    ll index = i;
    for (ll j = i + 1; j < N; j++) {
      if (t + (x[j] - x[j - 1]) <= L) {
        t += x[j] - x[j - 1];
      } else {
        break;
      }
      index = j;
    }
    {};
    doubling.set_next(i, index);
  }
  doubling.build();
  vector<ll> ans(Q, 0);
  for (ll q = 0, q_length = (Q); q < q_length; ++q) {
    ll a, b;
    cin >> a >> b;
    a--;
    b--;
    if (a > b) swap(a, b);
    ll left = N;
    ll right = 0;
    auto isOK = [&](ll val) -> bool {
      ll g = doubling.query(a, val);
      return g >= b;
    };
    while ((ll)abs(right - left) > 1) {
      ll mid = left + (right - left) / 2;
      if (isOK(mid))
        left = mid;
      else
        right = mid;
    }
    ans[q] = left;
  }
  for (ll q = 0, q_length = (Q); q < q_length; ++q) p(ans[q]);
}
signed main() {
  solve();
  return 0;
}
