using System;
using System.Text;


class A {
    int N;
    int maxN = 100005;
    long L;
    int Q;
    long[] x;
    public A(){
        x = new long[maxN];
    }
    public int calc(int a, int b){
        int now = a;
        int i = a;
        int cnt = 0;
        while(true){
            while(true){
                long dx = x[i]-x[now];
                long ndx = x[i+1]-x[now];
                if(dx<=L && ndx>L){
                    break;
                }
                i++;
            }
            cnt++;
            now = i;
            if(b<=now) break;
        }
        return cnt;
    }
    public string F(){
        return Console.ReadLine();
    }
    public void run(){
        N = int.Parse(F());
        string[] ss = F().Split(' '); 
        for(int i=0;i<N;i++){
            x[i] = long.Parse(ss[i]);
        }
        if(N>10000) return;
        x[N] = 10000000000;
        N = N+1;
        L = long.Parse(F());
        Q = int.Parse(F());
        
       
        StringBuilder sb = new StringBuilder("", 10*Q);
        for(int _=0;_<Q;_++){
            ss = F().Split(' '); 
            int a = int.Parse(ss[0])-1;
            int b = int.Parse(ss[1])-1;
            if(a>b){
                int tmp = a;
                a = b;
                b = tmp;
            }
            sb.Append(calc(a,b)+"\n");
        }
        Console.WriteLine(sb.ToString());
    }
}


class Program {
    static void Main(string[] args){
        A a = new A();
        a.run();    
    }
}