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

#define w cout
#define e '\n'
#define int long long
#define sz(x) (int)x.size()
template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }

int mod = 998244353;

void solve() {
	int n ; cin >> n;
	vector<int> v(n); cin >> v;
	int dd[n][30];
	int l , q; cin >> l >> q;
	memset(dd , -1 , sizeof dd);
	int par[n] = {};
	for(int i = 1; i < n ;i ++){
		int can = v[i] - l;
		if(can <= v[0]) {
			dd[i][0] = 0;
			continue;
		}
		par[i] = lower_bound(begin(v) , end(v) , can) - begin(v);
		dd[i][0] = par[i];
	}
	for(int i = 1; i < n ;i ++) {
		for(int j = 1; j < 30 ; j ++) {
			if(dd[i-1][j-1] == -1) continue;
			dd[i][j] = dd[dd[i][j-1]][j-1];
		}
	}
	
	while(q--) {
		int a , b; cin >> a >> b;
		a--,b--;
		if(a > b) swap(a , b);
		int ans = 0;
		
		for(int j = 29 ; j >= 0; j --) {
			if(dd[b][j] == -1) continue;
			//~ w << dd[b][j] << endl;
			if(dd[b][j] == a) {
				ans += pow(2 , j);
				break;
			}
			if(dd[b][j] > a) {
				ans += pow(2 , j);
				b = dd[b][j];
			}
		}
		w << ans + 1*(a != 0) << e;
	}
}

signed main() {
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t = 1; 
	//~ cin >> t;
	while(t--) {
		solve();
	}
} 
