#include<bits/stdc++.h>

using namespace std;

#define For(i, a, b) for(int i = a; i <= b; ++ i)
const int N = 1e5 + 5;

int n, l, q;
int x[N], rmq[N][20];

signed main(){
	ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
	cin >> n;
	For(i, 1, n) cin >> x[i];
	cin >> l >> q;
	For(i, 1, n){
		int pos = upper_bound(x + 1, x + n + 1, x[i] + l) - x;
		rmq[i][0] = pos - 1;
	}	
	for(int j = 1; j <= 18; ++j)
		for(int i = 1; i <= n; ++ i)
			rmq[i][j] = rmq[ rmq[i][j - 1]][j - 1];

	while(q --){
		int a, b, ans = 0; cin >> a >> b;
		if(a > b) swap(a, b);
		for(int i = 18; i >= 0; -- i) if(rmq[a][i] < b) a = rmq[a][i], ans += 1 << i;
		cout << ans + 1 << "\n";
	}
}