#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const double EPS = 1e-10;
double zero(double d) { return d < EPS ? 0.0 : d; }
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  return os << '(' << p.first << ',' << p.second << ')';
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &a) {
  os << '[';
  for (int i = 0; i < (int)(a.size()); i++) os << (i ? " " : "") << a[i];
  return os << ']';
}
string toString(int i) {
  stringstream ss;
  ss << i;
  return ss.str();
}
const int MOD = 1000000007;
long long fpow(long long a, long long k, int M) {
  long long res = 1ll;
  long long x = a;
  while (k != 0) {
    if ((k & 1) == 1) res = (res * x) % M;
    x = (x * x) % M;
    k >>= 1;
  }
  return res;
}
struct prepare {
  prepare() {
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(8);
    ios_base::sync_with_stdio(false);
  }
} _prepare;
int main() {
  int N;
  cin >> N;
  vector<long long> x(N), mx(N);
  for (int i = 0; i < (int)(N); i++) {
    cin >> x[i];
    mx[N - i - 1] = -x[i];
  }
  int L, Q;
  cin >> L >> Q;
  while (Q--) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    long long pos, goal;
    if (a > b) {
      pos = mx[N - a - 1];
      goal = mx[N - b - 1];
    } else {
      pos = x[a];
      goal = x[b];
    }
    int ans = 0;
    while (pos < goal) {
      vector<long long>::iterator it;
      if (a < b) {
        it = lower_bound(((x).begin()), ((x).end()), pos + L);
        if (*it - pos > L) --it;
      } else {
        it = lower_bound(((mx).begin()), ((mx).end()), pos + L);
        if (*it - pos > L) --it;
      }
      long long d = *it - pos;
      pos += d;
      ans++;
    }
    cout << ans << endl;
  }
  return 0;
}
