#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
const int maxn(1e5 + 5);
long long n, l, q;
long long s[maxn], fly[maxn];
void init() {
  n = read();
  for (int i(1); i <= n; ++i) s[i] = read();
  fly[0] = fly[1] = 1;
  l = read(), q = read();
  for (int i(1); i < n; ++i) {
    fly[i] = fly[i - 1];
    while (s[fly[i] + 1] - s[i] <= l && fly[i] < n) ++fly[i];
  }
}
signed main() {
  init();
  while (q--) {
    int a = read(), b = read(), tot = 0;
    if (a > b) {
      long long t = a;
      a = b;
      b = t;
    }
    if (fly[a] > b)
      tot = 1;
    else {
      while (fly[a] <= b) a = fly[a], ++tot;
      if (a != b) ++tot;
    }
    printf("%d\n", tot);
  }
  return 0;
}
