#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<long long> x(n), d(n - 1);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &x[i]);
    if (i) d[i - 1] = x[i] - x[i - 1];
  }
  long long l;
  scanf("%lld", &l);
  vector<int> c(n, -1);
  function<int(int)> calc = [&](int i) {
    if (c[i] != -1) return c[i];
    if (i == n - 1) return c[i] = 0;
    int ni = i;
    long long dd = 0;
    while (dd + d[ni] <= l) {
      dd += d[ni];
      ni++;
      if (ni == n) return c[i] = 1;
    }
    return c[i] = calc(ni) + 1;
  };
  for (int i = 0; i < n; i++) c[i] = calc(i);
  vector<bool> leftmost(n);
  leftmost[0] = true;
  for (int i = 1; i < n; i++) leftmost[i] = c[i] < c[i - 1];
  int q;
  scanf("%d", &q);
  while (q--) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--, b--;
    if (a > b) swap(a, b);
    long long ans = c[a] - c[b] + !leftmost[b];
    printf("%lld\n", ans);
  }
  return 0;
}
