#include<bits/stdc++.h>
#define INF 100000
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

int x[100000];
int r[18][100000];
int main() {
	int n; scanf("%d", &n);
	rep(i, n)scanf("%d", &x[i]);
	int l, q; scanf("%d%d", &l, &q);
	rep(i, n)r[0][i] = upper_bound(x, x + n, x[i] + l) - x - 1;
	for (int i = 1; i < 18; i++) {
		rep(j, n)r[i][j] = r[i - 1][r[i - 1][j]];
	}
	rep(i, q) {
		int a, b; scanf("%d%d", &a, &b); a--; b--;
		if (a > b)swap(a, b);
		int lb = 0, rb = INF;
		while (lb != rb) {
			int t = (lb + rb) / 2;
			int e = a, f = b;
			for (int i = 17; i >= 0; i--) {
				if (t >> i & 1)e = r[i][e];
			}
			if (e >= f)rb = t;
			else lb = t + 1;
		}
		printf("%d\n", lb);
	}
}