#include<bits/stdc++.h>
#define N (100009)
using namespace std;

int n,l,q,a,b,ans,x[N],f[N][21];

int main()
{
	cin>>n;
	for (int i=1; i<=n; ++i) cin>>x[i];
	cin>>l>>q;
	for (int i=1; i<=n; ++i)
	{
		int pos=upper_bound(x+1,x+n+1,x[i]+l)-x;
		f[i][0]=pos-1;
	}
	for (int i=1; i<=20; ++i)
		for (int j=1; j<=n; ++j)
			f[j][i]=f[f[j][i-1]][i-1];
	for (int i=1; i<=q; ++i)
	{
		cin>>a>>b; ans=0;
		if (a>b) swap(a,b);
		for (int i=20; i>=0; --i)
			if (f[a][i]<b) a=f[a][i], ans+=1<<i;
		ans++;
		cout<<ans<<endl;
	}
}