#include<iostream>
#include<cstdio>
#include<string>
#include<cfloat>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
#include<map>
#include<functional>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
const int mod = 1e9+7;
const int INFINT = INT_MAX/2;
typedef long long ll;
typedef unsigned long long ull;
int dp[40][100000];

void makeDoubling(vector<ull> &xs, ull L){
    int N = xs.size();
    for (int i=0;i<N;i++){
        dp[0][i] = lower_bound(xs.begin(), xs.end(), xs[i]+L+1) - xs.begin() - 1;
    }
    for (int i=1;i<40;i++){
        for (int j=0;j<N;j++){
            dp[i][j] = dp[i-1][dp[i-1][j]];
        }
    }
    return;
}

int MinimumDays(int a, int b){
    if(a > b) swap(a, b);
    int now = a;
    int res = 0;
    for (int i=39;i>=0;i--){
        if(dp[i][now] < b){
            now = dp[i][now];
            res += 1<<i;
        }
    }
    res++;
    return res;
}

int main(){
    int N, x;
    cin >> N;
    vector<ull> xs(N);
    for(int i=0;i<N;i++){
        cin >> x;
        xs[i] = x;
    }
    ull L, a, b;
    int Q, a, b;
    cin >> L >> Q;
    makeDoubling(xs, L);

    for (int i=0;i<Q;i++){
        cin >> a >> b;
        cout << MinimumDays(a-1, b-1) << endl;
    }

    return 0;
}