#include <bits/stdc++.h>

using namespace std;

#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
typedef long long ll;
typedef pair<int, int> pi;
const int INF = 0x3f2f1f0f;
const ll LINF = 1ll * INF * INF;

const int MAX_N = 1e5 + 10, LOG_N = 20;

int N, L, Q, Nr[MAX_N];
int P[LOG_N][MAX_N];
int main() {
	cin >> N; for(int i=1; i<=N; i++) scanf("%d", &Nr[i]); cin >> L >> Q;
	for(int l=1, r=1; l<=N; l++) {while(r+1<=N && Nr[r+1]-Nr[l] <= L) r++; P[0][l] = r;}
	for(int p=1; p<LOG_N; p++) for(int i=1; i<=N; i++) P[p][i] = P[p-1][P[p-1][i]];
	while(Q--) {
		int x, y; scanf("%d%d", &x, &y);
		if(x > y) swap(x, y);
		int ans = 0;
		for(int p=LOG_N-1; p>=0; p--) if(P[p][x] < y) ans += (1<<p), x = P[p][x];
		printf("%d\n", ans+1);
	}
	return 0;
}
