import sys
input = sys.stdin.readline

N = int(input())
x = list(map(int, input().split()))
L = int(input())
Q = int(input())
for _ in range(Q):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    if a > b:
        a, b = b, a
    ans = 1
    i = a
    d = 0
    while i < b:
        if d + x[i+1] - x[i] <= L:
            d += x[i+1] - x[i]
        else:
            ans += 1
            d = x[i+1] - x[i]
        i += 1
    print(ans)
