#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (a) swap(a, b %= a);
  return b;
}
const long long MOD = 1000000007LL;
long long ADD(long long x, long long y) { return (x + y) % MOD; }
long long SUB(long long x, long long y) { return (x - y + MOD) % MOD; }
long long MUL(long long x, long long y) { return x * y % MOD; }
long long POW(long long x, long long e) {
  long long v = 1;
  for (; e; x = MUL(x, x), e >>= 1)
    if (e & 1) v = MUL(v, x);
  return v;
}
long long DIV(long long x, long long y) { return MUL(x, POW(y, MOD - 2)); }
char _buf[12 * 1000000 + 3];
int loadint() {
  if (fgets(_buf, 12 + 3, stdin) == NULL) return 0;
  return atoi(_buf);
}
int loadvec(vector<int> &v, int N = -1) {
  if (N == -1) {
    N = loadint();
    if (N == 0) return 0;
  }
  int bufsize = 12 * N + 3;
  if (fgets(_buf, bufsize, stdin) == NULL) return 0;
  v.resize(N);
  int i = 0;
  bool last = false;
  for (char *p = &_buf[0];;) {
    char *q = p;
    while (*q > ' ') ++q;
    if (*q == 0x0D || *q == 0x0A) last = true;
    *q = 0;
    v[i++] = atoi(p);
    if (last || i == N) break;
    p = q + 1;
  }
  return i;
}
void read_cr() { fgets(_buf, 256, stdin); }
int N, L, Q;
vector<int> x;
vector<vector<int>> reach;
int R;
void prepare() {
  R = 0;
  for (int x = N; x > 0; x /= 2) ++R;
  reach.resize(R);
  reach[0].resize(N);
  for (int i = 0; i < (N); ++i) {
    auto it = lower_bound((x).begin(), (x).end(), x[i] + L + 1);
    reach[0][i] = (int)(it - x.begin() - 1);
  }
  for (int l = 1, d = 2; d < N; ++l, d *= 2) {
    reach[l].resize(N);
    for (int i = 0; i < (N); ++i) {
      int hop = reach[l - 1][i];
      if (hop == N) {
        reach[l][i] = N;
      } else {
        int step = reach[l - 1][hop];
        reach[l][i] = (step == hop) ? N : step;
      }
    }
  }
}
pair<int, int> step(int from, int to) {
  assert(from <= to);
  if (from == to) return pair<int, int>(0, to);
  int moves = 0, curr = from;
  for (int l = 0; l < (R); ++l) {
    int r = reach[l][from];
    if (to < r) {
      break;
    }
    moves = 1 << l;
    curr = reach[l][from];
  }
  return pair<int, int>(moves, curr);
}
int query(int a, int b) {
  assert(((1) <= (a) && (a) <= (N)) && ((1) <= (b) && (b) <= (N)) && a != b);
  --a;
  --b;
  if (a > b) swap(a, b);
  assert(a < b);
  int moves = 0;
  for (int curr = a; curr < b;) {
    pair<int, int> m = step(curr, b);
    if (m.first == 0) {
      ++moves;
      break;
    }
    moves += m.first;
    curr = m.second;
  }
  return moves;
}
int main() {
  N = loadvec(x);
  cin >> L;
  prepare();
  cin >> Q;
  for (int q = 0; q < (Q); ++q) {
    int a, b;
    cin >> a >> b;
    cout << query(a, b) << endl;
  }
  return 0;
}
