#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;

const int N=100005;

int n,T,l,s,t,r,mid;
int f[N][18],x[N];

void init(){
	int i,j;
	for (i=1;i<=n;i++)
		for (j=0;j<=17;j++) f[i][j]=n;
	for (i=1;i<n;i++) f[i][0]=lower_bound(x+1,x+1+n,x[i]+l+1)-x-1;
	for (j=1;j<=17;j++)
		for (i=1;i<=n;i++) f[i][j]=f[f[i][j-1]][j-1];
}

int go(int st,int d){
	int i;
	for (i=17;i>=0;i--)
		if (d>=(1<<i)){
			st=f[st][i];
			d-=(1<<i);
		}
	return st;
}

int main(){
	int i;
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d",&x[i]);
	scanf("%d",&l);
	init();
	scanf("%d",&T);
	while (T--){
		scanf("%d%d",&s,&t); if (s>t) swap(s,t);
		l=1; r=n;
		while (l<r){
			mid=l+(r-l)/2;
			if (go(s,mid)>=t) r=mid;
			else l=mid+1;
		}
		printf("%d\n",r);
	}
	return 0;
}