#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#define REP(i,n) for (int i=1;i<=(n);++i)
#define FOR(i,a,b) for (int i=(a);i<=(b);++i)
#define ROF(i,a,b) for (int i=(a);i>=(b);--i)
#define FEC(p,u) for (edge*p=head[u];p;p=p->nxt)
using namespace std;
typedef long long LL;

int n, L, Q, x[110000];
int a[110000][20];
int main(){
	scanf("%d", &n);
	REP(i,n) scanf("%d", x+i);
	scanf("%d%d", &L, &Q);
	REP(i,n) a[i][0] = upper_bound(x+i, x+n+1, x[i]+L)-x-1;
	FOR(j,1,17) REP(i,n) a[i][j] = a[a[i][j-1]][j-1];
	int u, v, ans;
	while (Q--){
		scanf("%d%d", &u, &v);
		if (u > v) swap(u, v);
		ans = 0;
		ROF(j,17,0) { 
			if (a[u][j] < v) {
				u = a[u][j];
				ans += 1<<j;
			}
		}
		printf("%d\n", ans+1);
	}
	return 0;
}
