// Author : SAGORIKA DAS
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define CLEAR(a) memset(a,0,sizeof a)
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define fr freopen("input.txt", "r", stdin);
#define fw freopen("output.txt", "w", stdout);
#define int long long 
typedef long long LL;
typedef pair<int,int> pii;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 5;
int x[MAX];

main(){
    //fr;fw;
    int n;
    cin >> n;
    FOR(i,1,n) cin >> x[i];
    int l,q;
    cin >> l >> q;
    while(q--){
        int a, b;
        cin >> a >> b;
        if(a < b){
        int ret = 0;
        int st = x[a] + l;
        for(int i=a+1;i <=b;i++){
            if(x[i] <= st) continue;
            else{
                ret++;
                st = x[i-1]+l;
            }
        }
        cout << ret+1 <<"\n";
       }
       else{
        int ret = 0;
        int st = x[a] - l;
        for(int i=a-1;i>=b;i--){
            if(x[i] >= st) continue;
            else{
                ret ++;
                st = x[i+1]-l;
            }
        }
        cout << ret+1 <<"\n";
       }
    }
}