#include<bits/stdc++.h>
#define N 100005
using namespace std;
inline int read(){
	int ans=0;
	char ch=getchar();
	while(!isdigit(ch))ch=getchar();
	while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch^48),ch=getchar();
	return ans;
}
int l,n,x[N],Q,tim[N],next[N],hd,tl,q[N],blo[N],sig;
int main(){
	n=read(),sig=sqrt(n);
	for(int i=1;i<=n;++i)x[i]=read();
	l=read(),Q=read();
	hd=tl=1,q[tl]=n,tim[n]=0,next[n]=n+1;
	for(int i=n-1;i;--i){
		while(x[q[hd]]-x[i]>l)++hd;
		next[i]=q[hd],q[++tl]=i;
	}
	for(int i=1;i<=n;++i)blo[i]=(i-1)/sig+1;
	for(int i=n-1;i;--i)
		if(blo[next[i]]==blo[i])tim[i]=x[i]+l>=x[n]?1:tim[next[i]]+1,next[i]=next[next[i]];
		else tim[i]=1;
	while(Q--){
		int a=read(),b=read(),cnt=0;
		if(a>b)a^=b,b^=a,a^=b;
		while(blo[a]<blo[b])cnt+=tim[a],a=next[a];
		int sum=0;
		for(int i=a+1;i<=b;++i){
			sum+=x[i]-x[i-1];
			if(sum>=l)sum=0,++cnt;
		}
		printf("%d\n",cnt);
	}
	return 0;
}