import std.stdio, std.string, std.conv;
import std.algorithm, std.array;
import std.math, core.bitop;
 
auto solve(string s_)
{
    immutable N = s_.to!int();
    immutable xs = readln.split.map!(to!int).array();
    immutable L = readln.chomp.to!int();
    immutable Q = readln.chomp.to!int();
    auto ab = new int[2][Q];
    foreach(ref v;ab) v = readln.split.map!(to!int).array();
    immutable D = (xs[$-1]-xs[0]+L-1)/L;
    immutable M = bsr(D)+((D&D-1)?0:1);
    auto ld = new int[][](N+1,M);
    for(int i=0,j=0; i<N; ++i)
    {
        while(j<i && (xs[i]-xs[j])>L) ld[j++][0]=i-1;
        if(i+1==N) while(j<N) ld[j++][0]=i;
    }
    ld[N-1][0]=N;
    ld[N][]=N;
    foreach(i;1..M) foreach(j;0..N) ld[j][i]=ld[ld[j][i-1]][i-1];
    int[] r; r.reserve(Q);
    foreach(ref v;ab)
    {
        auto a=v[0]-1,b=v[1]-1;
        if(a>b) swap(a,b);
        int d=0;
        while(a<b)
        {
            int lo=0, hi=M;
            while(lo+1<hi)
            {
                immutable m = (lo+hi)/2;
                if(ld[a][m]<=b) lo=m;
                else            hi=m;
            }
            d+=1<<lo;
            a=ld[a][lo];
        }
        r~=d;
    }
    return r.map!(to!string).join("\n");
}

void main(){ for(string s; (s=readln.chomp()).length;) writeln(solve(s)); }