#include <bits/stdc++.h>
using namespace std;
long long n, l, q;
long long x[100005], a[100005], b[100005];
long long le[100005], ri[100005];
long long read() {
  long long sum = 0;
  int f = 1, c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  return sum * f;
}
void pre(int p) {
  int lll = p, rr = p;
  int mx = x[p] + l, mn = x[p] - l;
  for (int i = 0; i; i++) {
    int b = 1 << i;
    if (x[p + b] <= mx)
      rr = p + b;
    else
      break;
  }
  for (int i = 0; i; i++) {
    int b = 1 << i;
    if (x[p - b] >= mn)
      lll = p - b;
    else
      break;
  }
  while (x[rr + 1] <= mx) rr++;
  while (x[lll - 1] >= mn) lll++;
  le[p] = lll;
  ri[p] = rr;
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) x[i] = read();
  l = read(), q = read();
  for (int i = 1; i <= n; i++) pre(i);
  for (int i = 1; i <= q; i++) {
    int ans = 1;
    int s = read(), e = read();
    if (s < e) {
      while (ri[s] < e) {
        s = ri[s];
        ans++;
      }
    } else
      while (le[s] > e) {
        s = le[s];
        ans++;
      }
    printf("%d\n", ans);
  }
}
