#include<bits/stdc++.h>

using namespace std;

int lg, N, L, Q, x[100009], nxt[18][100009];

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d", &N);
for (int i=1; i<=N; i++)
    scanf ("%d", &x[i]);
scanf ("%d", &L);
int j = 1;
for (int i=1; i<=N; i++)
{
    while (j < N && x[j + 1] - x[i] <= L) j ++;
    nxt[0][i] = j;
}
for (int i=1; (1 << i) < N; lg = i, i++)
    for (int j=1; j<=N; j++)
        nxt[i][j] = nxt[i - 1][nxt[i - 1][j]];
scanf ("%d", &Q);
while (Q --)
{
    int st, dr, ans = 0;
    scanf ("%d %d", &st, &dr);
    if (st > dr) swap (st, dr);
    for (int i=lg; i>=0; i--)
        if (nxt[i][st] < dr) ans |= 1 << i, st = nxt[i][st];
    printf ("%d\n", ans + 1);
}
return 0;
}
