#include <bits/stdc++.h>

using namespace std;

int n, l, q;
long long x[111111];
int f[111111][22];

int main(){
//	freopen("input.inp", "r", stdin);
	scanf("%d",&n);
	for(int i = 1; i <= n; ++i) scanf("%lld",&x[i]);
	scanf("%d%d",&l,&q);
	for(int i = 1; i <= n; ++i){
		int ll = i + 1, rr = n;
		while (ll <= rr){
			int md = (ll + rr) >> 1;
			if (x[md] - x[i] <= l) ll = md + 1;
			else rr = md - 1;
		}
		f[i][0] = rr;
	}
	for(int j = 1; j < 17; ++j){
		for(int i = 1; i <= n; ++i){
			f[i][j] = f[f[i][j - 1]][j - 1];
		}
	}
	while (q--){
		int a, b;
		scanf("%d%d",&a,&b);
		if (a > b) swap(a, b);
		int an = 0;
		for(int i = 16; i >= 0; --i){
			if (f[a][i] < b) a = f[a][i], an += (1 << i);
		}
		printf("%d\n",an + 1);
	}
	return 0;
}