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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define maxn 200010
#define int ll

int N,L,Q;
int A[maxn];
vi adj[maxn];

int twok[maxn][100],depth[maxn],dist[maxn][100];

bool vis[maxn];
void twokdecomp(int x,int p){
	vis[x] = 1;
	twok[x][0] = p;
	for (int i=1;i<=18;i++){ //i <= logmaxn
		if (twok[x][i-1] == -1) break;
		twok[x][i] = twok[twok[x][i-1]][i-1];
		dist[x][i] = dist[x][i-1] + dist[twok[x][i-1]][i-1]; //only for dist, can change to min/max
	}
	for (auto i: adj[x]){
		if (i != p){
			depth[i] = depth[x] + 1;
			dist[i][0] = 1; //only for dist
			twokdecomp(i,x);
		}
	}
}

pi kth_parent(int x,int k){ //pi for dist,logk
	int distans = 0; //only for dist
	
	for (int i=0;i<=17;i++){
		if (k&(1<<i)){
			x = twok[x][i];
			distans += dist[x][i]; //Only for dist, can change to min/max
		}
		if (x==-1) break;
	}
	return pi(x,distans); //return pi(x,distans) for dist

}



int32_t main(){
	fast;
	
	cin>>N;
	FOR(i,1,N) cin>>A[i];
	
	cin>>L>>Q;
	
	FOR(i,1,N-1){
		if (A[i+1] - A[i] > L) continue;
		
		int idx = lower_bound(A+1,A+N+1,A[i] + L) - A;
		
		if (idx == N+1 || A[idx] > A[i] + L) idx--;

		adj[i].pb(idx);
		adj[idx].pb(i);
		
	}
	
	mem(twok,-1);
	
	DEC(i,N,1){
		if (!vis[i]){
			dist[i][0] = -1;
			twokdecomp(i,-1);
	}
	
	

	
	FOR(i,0,Q-1){
		int a,b; cin>>a>>b;
		if (a > b) swap(a,b);
		
		int l=0,r=maxn;
		
		while (l + 1 < r){
			int mid = (l+r)/2;
			if (kth_parent(a,mid).f == -1) r = mid;
			else if (kth_parent(a,mid).f > b) r = mid;
			else l = mid;
		}
		
		cout<<l<<'\n';
		
	}
			
	
	
}
