#include<bits/stdc++.h>
using namespace std;

int a[100005];
int dp[100005][50];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i = 1;i <= n;i++)
		scanf("%d",&a[i]);
	int L,Q;
	scanf("%d%d",&L,&Q);
	for(int i = 1;i <= n;i++)
	{
		int id = (int) (upper_bound(a+1,a+1+n,a[i]+L)-a-1);
		if(a[i] + L >= a[n])
			dp[i][0] = n;
		else
			dp[i][0] = id;
	}
	
	for(int i = 1;i <= 30; i++)
		for(int j = 1;j <= n; j++)
			dp[j][i] = dp [dp[j][i-1]][i-1];
	while(Q--)
	{
		int L,R;
		scanf("%d%d",&L,&R);
		if(R<L)
			swap(L,R);
		int ans = 1;
		for(int i=30;i>=0;i--)
		{
			if(dp[L][i] < R)
			{
				ans = ans + (1<<i);
				L = dp[L][i];
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}