L,x[1<<17];d[20][1<<17];i,k,l,r,m;
main(n){
	for(scanf("%d",&n);i<n;)scanf("%d",++i+x);
	for(scanf("%d\n",&L);k<20;k++)for(i=0;i++<n;)
		if(k)d[k][i]=d[k-1][d[k-1][i]];
		else for(l=0,r=n;r-l>1;d[k][i]=l)x[m=l+r>>1]<=x[i]+L?l=m:(r=m);
	for(gets(x);~scanf("%d%d",&l,&r);printf("%d\n",m+1))
		for(l>r&&(l^=r^=l^=r),m=0,k=20;k--;)d[k][l]<r?m+=1<<k,l=d[k][l]:0;
}