#!/usr/bin/env pypy3


MAX_N = 10 ** 3
MAX_Q = 10 ** 3


def answer_query(ds, l, a, b):
    if a > b:
        a, b = b, a
    allowed_dist = l
    ans = 1
    for d in ds[a:b]:
        if allowed_dist >= d:
            allowed_dist -= d
        else:
            allowed_dist = l - d
            ans += 1
    return ans


def main():
    n = int(input())
    assert n <= MAX_N
    xs = list(map(int, input().split()))
    ds = [xj - xi for xi, xj in zip(xs[:-1], xs[1:])]
    l = int(input())
    q = int(input())
    assert q <= MAX_Q
    for _ in range(q):
        a, b = map(lambda x: int(x) - 1, input().split())
        print(answer_query(ds, l, a, b))


if __name__ == '__main__':
    main()
