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

int main()
{
    int n, a[200001], sum[200001], maxi[200001], q, dis, c, b, itr = 1;
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> a[i];
    cin >> dis;
    for(int i = 1; i < n; i++){
        int l = i + 1, r = n;
        while(l != r){
            int mid = (l + r) / 2;
            if(a[mid] - a[i] < dis) l = mid + 1;
            else r = mid;
        }
        if(a[l] - a[i] > dis) l--;
        maxi[i] = l;
    }
    maxi[n] = n;
    sum[1] = 0;
    while(itr < n){
        int itr2 = itr;
        itr = maxi[itr];
        for(int i = itr2 + 1; i <= itr; i++) sum[i] = sum[itr2] + 1;
    }
    cin >> q;
    for(int i = 0; i < q; i++){
        cin >> c >> b;
        if(sum[b] == sum[c]) cout << 1 << endl;
        else if(abs(b - c) <= l * (sum[b] - sum[c])) cout << abs(sum[b] - sum[c]) << endl;
        else cout << abs(sum[b] - sum[c]) + 1 << endl;
    }
}