#include <bits/stdc++.h>
using namespace std;
template <typename T>
using Vec = vector<T>;
template <typename T>
using Matrix = Vec<Vec<T> >;
template <typename T>
using USet = unordered_set<T>;
template <typename T, class C>
using MyUSet = unordered_set<T, C>;
template <typename T, typename F>
using UMap = unordered_map<T, F>;
template <typename T, typename F, class C>
using MyUMap = unordered_map<T, F, C>;
class PiiHash {
 public:
  size_t operator()(const pair<int, int>& p) const {
    return (p.first << 16) | p.second;
  }
};
inline int POPCNT(int x) { return __builtin_popcount(x); }
inline int POPCNT(long long x) { return __builtin_popcount(x); }
const int iINF = 1L << 30;
const long long lINF = 1LL << 60;
const double EPS = 1e-9;
const double PI = acos(-1);
template <typename T>
inline bool in_range(T v, T mi, T mx) {
  return mi <= v && v < mx;
}
template <typename T>
inline bool in_range(T x, T y, T W, T H) {
  return in_range(x, 0, W) && in_range(y, 0, H);
}
const int DX[4] = {0, 1, 0, -1}, DY[4] = {-1, 0, 1, 0};
const int DX_[8] = {0, 1, 1, 1, 0, -1, -1, -1},
          DY_[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
template <typename T>
inline void modAdd(T& a, T b, T mod) {
  a = (a + b) % mod;
}
template <typename T>
inline void minUpdate(T& a, T b) {
  a = min(a, b);
}
template <typename T>
inline void maxUpdate(T& a, T b) {
  a = max(a, b);
}
template <typename F, typename T>
inline void convert(F& from, T& to) {
  stringstream ss;
  ss << from;
  ss >> to;
}
int N, L, Q, x[100010], rx[100010], pow2[20];
Vec<Vec<int> > par, rpar;
void preProc(int* xx, Vec<Vec<int> >& pp) {
  Vec<long long> sum(N, 0);
  for (int i = (0); i < (N); ++i) sum[i + 1] = sum[i] + abs(xx[i + 1] - xx[i]);
  for (int i = (0); i < (N); ++i) {
    int lb = i + 1, ub = N;
    while (ub - lb > 1) {
      int med = (lb + ub) / 2;
      long long dst = sum[med] - sum[i];
      if (dst > (long long)L)
        ub = med;
      else
        lb = med;
    }
    pp[i][0] = lb;
  }
  for (int k = (0); k < (20); ++k)
    for (int i = (0); i < (N); ++i) {
      if (pp[i][k] < 0)
        pp[i][k] = -1;
      else
        pp[i][k + 1] = pp[pp[i][k]][k];
    }
}
void query(int a, int b, Vec<Vec<int> >& par) {
  int ans = 0;
  for (int k = (20); k >= (0); --k) {
    if (par[a][k] < 0) continue;
    if (b < par[a][k]) continue;
    a = par[a][k];
    ans += pow2[k];
    if (a == b) {
      printf("%d\n", ans);
      return;
    }
    if (b < par[a][0]) {
      printf("%d\n", ans + 1);
      return;
    }
  }
}
int main() {
  cin >> N;
  for (int i = (0); i < (N); ++i) {
    cin >> x[i];
    rx[N - i - 1] = x[i];
  }
  cin >> L;
  x[N] = L;
  rx[N] = L;
  par.assign(N + 1, Vec<int>(25, -1));
  preProc(x, par);
  rpar.assign(N + 1, Vec<int>(25, -1));
  preProc(rx, rpar);
  pow2[0] = 1;
  for (int i = (1); i < (20); ++i) pow2[i] = pow2[i - 1] * 2;
  cin >> Q;
  for (int q = (0); q < (Q); ++q) {
    int a, b;
    scanf("%d %d", &a, &b);
    --a;
    --b;
    if (a < b)
      query(a, b, par);
    else
      query(N - a - 1, N - b - 1, rpar);
  }
}
