#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef pair<int,int> P;
typedef long long int lnt;
const lnt INF 0xffffffffffffff;
lnt n,x[100000],l,q,a[100000],b[100000];
lnt lca[20][100000];
lnt aaa,bbb;
int main()
{
	cin>>n;
	for(lnt i=0;i<n;i++){
		cin>>x[i];
	}
	cin>>l>>q;
	for(lnt i=0;i<q;i++){
		cin>>aaa>>bbb;
		a[i]=min(aaa-1,bbb-1);
		b[i]=max(aaa-1,bbb-1);
	}
	for(lnt i=0;i<20;i++){
		for(lnt j=0;j<100000;j++) lca[i][j]=INF;
	}
	for(lnt i=0;i<n-1;i++){
		if(x[i]+l>=x[n-1]){
			lca[0][i]=n-1;
			continue;
		}
		lca[0][i]=upper_bound(x,x+n,x[i]+l)-x-1;
	}
	lnt now,ans=0;
	for(lnt i=0;i<q;i++){
		ans=0;
		now=a[i];
		while(now<b[i]){
			now=lca[0][now];
			ans++;
		}
		cout<<ans<<endl;
	}
}