#include <bits/stdc++.h>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define intmax 2147483647
#define llmax 9223372036854775807
#define lP pair<ll,ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;
const int mod = 1000000007;
const int mod998 = 998244353;


int N, L, Q, x[100000], a, b, p, l[100000][18], r[100000][18];

int fl(int x) {
	if (x == -1) {
		if (a == b) {
			return 0;
		}
		else {
			return 1;
		}
	}
	if (l[a][x] >= b) {
		return fl(x - 1);
	}
	else {
		a = l[a][x];
		return (1 << x) + fl(x - 1);
	}
}
int fr(int x) {
	if (x == -1) {
		if (a == b) {
			return 0;
		}
		else {
			return 1;
		}
	}
	if (r[a][x] =< b) {
		return fr(x - 1);
	}
	else {
		a = r[a][x];
		return (1 << x) + fr(x - 1);
	}
	return 0;
}

int main() {
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> x[i];
	}
	cin >> L >> Q;
	for (int i = 0; i < N; ++i) {
		for (; p < N && x[p] <= x[i] + L; ++p);
		l[i][0] = p - 1;
	}
	p = N - 1;
	for (int i = N - 1; i >= 0; --i) {
		for (; p >= 0 && x[i] - L<=x[p]; --p);
		r[i][0] = p + 1;
	}
	for (int i = 1; i < 18; ++i) {
		for (int j = 0; j < N; ++j) {
			l[j][i] = l[l[j][i - 1]][i - 1];
			r[j][i] = r[r[j][i - 1]][i - 1];
		}
	}
	while (Q--) {
		cin >> a >> b;
		--a;
		--b;
		if (a < b) {
			cout << fl(17) << endl;
		}
		else {
			cout << fr(17) << endl;
		}
	}
	return 0;
}