#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[17][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 < 17; 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 cnt = 0;
		for (int i = 16; i >= 0; i--) {
			if (r[i][a] < b) {
				a = r[i][a]; cnt += 1 << i;
			}
		}
		printf("%d\n", cnt + 1);
	}
}