#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef pair<int,int>P;
#define F first
#define S second

int a[100009][20];
int b[100009];
int n,L,test;

signed main(){
	cin>>n;
	r(i,n) cin>>b[i];
	cin>>L;
	r(j,20){
		if(j==0){
			int id=0,sum=0;
			r(i,n){
				while(id<n-1 && sum+(b[id+1]-b[id])<=L) sum += b[id+1]-b[id],id++;
				a[i][j] = id;
				//cout<<id<<endl;
				if(i!=n-1 && sum)sum -=b[i+1]-b[i];
			}
		}
		else{
			r(i,n){
				a[i][j] = a[a[i][j-1]][j-1];
			}
		}
	}



	cin>>test;
	while(test--){
		int l,r;
		cin>>l>>r; l--; r--;
		if(r<l)swap(l,r);
		int sum=0;
		while(l<r){
			//cout<<l<<endl;
			for(int i=19;i>=0;i--){
				if(i&&( a[l][i]>=r ))continue;
				//cout<<l<<' '<<i<<' '<<a[l][i]<<' '<<i<<endl;
				l=a[l][i];
				sum+=pow(2,i);
				break;
			}
			//cout<<l<<endl;
		}
		cout<<sum<<endl;
	}
}

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

const int inf = 2e9;
const int N = 100100;

int n, x[N], L, Q, dp[N][17];

void calc() {
	for (int i = 0; i < N; i++)
		for (int j = 0; j < 17; j++)
			dp[i][j] = inf;
	for (int i = 1; i <= n; i++) {
		auto it = upper_bound(x + 1, x + 1 + n, x[i] + L);
		it--;
		dp[i][0] = it - x;
	}
	for (int j = 1; j < 17; j++)
		for (int i = 1; i <= n; i++) 
			dp[i][j] = dp[dp[i][j - 1]][j - 1];			
}

int get(int l, int r) {
	if (l > r) swap(l, r);
	int ll = 1, rr = n - 1, res = r - l;
	while (ll <= rr) {
		int mid = ll + rr >> 1, cur = l;
		for (int i = 0; i < 17; i++)
			if (mid & (1 << i)) cur = dp[cur][i];
		if (cur >= r) {
			res = mid;
			rr = mid - 1;
		} else ll = mid + 1;
	}
	return res;
}

int main() {
	cin >> n;
	fill(x, x + N, inf);
	for (int i = 1; i <= n; i++) 
		cin >> x[i];
	cin >> L >> Q;
	calc();
	while (Q--) {
		int l, r;
		cin >> l >> r;
		cout << get(l, r) << '\n';
	}
}
