n=int(input())
x=input().split()
for i in range(n):
    x[i]=int(x[i])
l=int(input())
q=int(input())
ques=[]
for i in range(q):
    currque=input().split()
    a,b=int(currque[0])-1,int(currque[1])-1
    currque[0],currque[1]=min(a,b),max(a,b)
    ques.append(currque)
for que in ques:
    days=1
    time=0
    hotel=que[0]
    while hotel<que[1]:
        hotel+=1
        time+=x[hotel]-x[hotel-1]
        if time>l:
            days+=1
            time=x[hotel]-x[hotel-1]

    print (days)
