N = int(input())
X = list(map(int,input().split()))
L = int(input())
Q = int(input())
qs = [tuple(map(int,input().split())) for i in range(Q)]

if N>1000 or Q>1000:
    exit()

ans = []
for a,b in qs:
    a,b = a-1,b-1
    if a<b:
        l = k = 0
        for i in range(a,b):
            if l + X[i+1]-X[i] > L:
                k += 1
                l = X[i+1]-X[i]
            else:
                l += X[i+1]-X[i]
    else:
        l = k = 0
        for i in range(a,b,-1):
            if l + X[i]-X[i-1] > L:
                k += 1
                l = X[i]-X[i-1]
            else:
                l += X[i]-X[i-1]
    ans.append(k + int(l>0))

print(*ans,sep='\n')