#include <bits/stdc++.h>
using namespace std;

const int MAXN = 1e5+10;
int dp[30][MAXN],x[MAXN],l,n;
int q;

int main()
{
    int i,j;
    cin >> n;
    for(int i = 1; i <= n; ++i)
        cin >> x[i];
    cin >> l;
    for(int i = 1; i < n; ++i)
        dp[0][i] = upper_bound(x+1,x+n+1,x[i]+l) - x - 1;
    for(i = 1; i < 30; ++i)
    {
        for(j = 1; j <= n; ++j)
            dp[i][j] = dp[i-1][dp[i-1][j]];
    }
    cin >> q;
    int a,b,res;
    while(q--)
    {
        res = 0;
        cin >> a >> b;
        if(a > b) swap(a,b);
        for(i = 29; i >= 0; --i)
        {
            if(dp[i][a] == 0) continue;
            if(dp[i][a] < b)
            {
                a = dp[i][a];
                res += (1<<i);
            }
        }
        cout << res+1 << endl;
    }
    return 0;
}
