//	Author:	Mohib Manva
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int rig[30][111111];
int n, q, l, u, v;
int x[111111];
 
int main(void)
{
	scanf("%d",&n);
	int i, j;
	for(i=0 ; i<n ; i++)
	{
		scanf("%d",&x[i]);
	}
	scanf("%d %d",&l,&q);
	for(i=0 ; i<n ; i++)
	{
		int lo = i+1,high = n-1;
		int last = i+(i!=(n-1));
		while(lo<=high){
			int mi = (lo+high)>>1;
			if(a[mi]-a[i]<=l)
				lo = mi+1,last = mi;
			else
				high = mi-1;
		}
		dp[0][i]=last;
	}
	for(i=1;  i<=29 ; i++)
	{
		for(j=0 ; j<n ; j++)
		{
			dp[i][j]=dp[i-1][dp[i-1][j]];
		}
	}
	while(q--)
	{
		scanf("%d %d",&u,&v);
		u--; v--;
		if(u>v)
		{
			int temp=v;
			v=u;
			u=temp;
		}
		int ans=1e9;
		int cur=0;
		for(i=29 ; i>=0 ; i--)
		{
			if(dp[i][u]>=v)
			{
				ans=min(ans,cur+(1<<i));
			}
			else
			{
				cur+=(1<<i);
				u=dp[i][u];
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}