#include <vector>
#include <iostream>
#pragma warning(disable : 4996)
using namespace std;
int N, L, Q, a, b, x[100009], p[20][100009];
int main() {
	scanf("%d", &N);
	for (int i = 0; i < N; i++) scanf("%d", &x[i]);
	scanf("%d%d", &L, &Q);
	for (int i = 0, r = 0; i < N; i++) {
		while (r < N - 1 && x[r + 1] - x[i] <= L) r++;
		p[0][i] = r;
	}
	for (int i = 0; i < 17; i++) {
		for (int j = 0; j < N; j++) {
			p[i + 1][j] = p[i][p[i][j]];
		}
	}
	while (Q--) {
		scanf("%d%d", &a, &b); a--, b--;
		if (a > b) swap(a, b);
		int sum = 0;
		for (int i = 17; i >= 0; i--) {
			if (p[i][a] < b) sum += 1 << i, a = p[i][a];
		}
		printf("%d\n", sum + 1);
	}
	return 0;
}