#include <bits/stdc++.h>

using namespace std;

const int N = 100005;

int x[N], p[N], d[N], pa[N][20];
int n, l, q, a, b;
vector<int> G[N];

void dfs(int v, int depth) {
	d[v] = depth;
	pa[v][0] = p[v];
	for(int k=1;k<20;k++)
		pa[v][k] = pa[pa[v][k-1]][k-1];
	for(int ch:G[v])
		dfs(ch, depth+1);
}

int main()
{
	cin >> n;
	for(int i=0;i<n;i++)
		cin >> x[i];
	cin >> l >> q;
	p[n-1]=n-1;
	for(int i=0;i<n-1;i++) {
		p[i] = upper_bound(x+i, x+n, x[i]+l)-x-1;
		G[p[i]].push_back(i);
	}
	dfs(n-1, 0);
	while(q--) {
		int ct = 0;
		cin >> a >> b;
		a--, b--;
		if(a > b) swap(a, b);
		for(int k=__lg(n);k>=0;--k){
			if(d[pa[a][k]] > d[b])
				a = pa[a][k], ct += 1 << k;
		}
		cout << ++ct << endl;
	}
}
