#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int ans = 0;
  char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) ans = (ans << 3) + (ans << 1) + (ch ^ 48), ch = getchar();
  return ans;
}
int l, n, x[100005], Q, tim[100005], nxt[100005], hd, tl, q[100005],
    blo[100005], sig;
int main() {
  n = read(), sig = sqrt(n);
  for (int i = 1; i <= n; ++i) x[i] = read();
  l = read(), Q = read();
  hd = tl = 1, q[tl] = n, tim[n] = 0, nxt[n] = n + 1;
  for (int i = n - 1; i; --i) {
    while (x[q[hd]] - x[i] > l) ++hd;
    nxt[i] = q[hd], q[++tl] = i;
  }
  for (int i = 1; i <= n; ++i) blo[i] = (i - 1) / sig + 1;
  for (int i = n - 1; i; --i)
    if (blo[nxt[i]] == blo[i])
      tim[i] = x[i] + l >= x[n] ? 1 : tim[nxt[i]] + 1, nxt[i] = nxt[nxt[i]];
    else
      tim[i] = 1;
  while (Q--) {
    int a = read(), b = read(), cnt = 0;
    if (a > b) a ^= b, b ^= a, a ^= b;
    while (blo[a] < blo[b]) cnt += tim[a], a = nxt[a];
    int sum = 0;
    for (int i = a + 1; i <= b; ++i) {
      sum += x[i] - x[i - 1];
      if (sum >= l) sum = 0, ++cnt;
    }
    printf("%d\n", cnt);
  }
  return 0;
}
