#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=(a);i<(n);i++)
#define per(i,n,a) for (int i=(n)-1;i>=(a);i--)
#define SZ(a) int((a).size())
typedef vector<int> VI;
#define pb push_back

const int N=100010;
int n,L,q,x[N],g[20][N];

int main() {
	scanf("%d",&n);
	rep(i,0,n) {
		scanf("%d",x+i);
	}
	scanf("%d %d",&L,&q);
	rep(i,0,n) g[0][i]=upper_bound(x,x+n,x[i]+L)-x-1;
	rep(k,1,20) rep(i,0,n) g[k][i]=g[k-1][g[k-1][i]];
	rep(i,0,q) {
		int x,y;
		scanf("%d %d",&x,&y); x--; y--;
		if (x>y) swap(x,y);
		int ans=0;
		per(k,20,0) if (g[k][x]<y) {
			x=g[k][x];
			ans+=1<<k;
		}
		printf("%d\n",ans+1);
	}
}
