#include<iostream>
#include<cstdio>
using namespace std;
int n,q,l,a[111111],x,y,pos,prev,cnt;
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	scanf("%d%d",&l,&q);
	while(q--)
	{
		scanf("%d%d",&x,&y);
		if (x>y) swap(x,y);
		pos=x;cnt=0;
		while(pos<y)
		{
			prev=pos;
			while(pos<=y && a[pos]-a[prev]<=l) pos++;
			pos--;
			cnt++;
		}
		printf("%d\n",cnt);
	}
	return 0;
}