import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio, std.bitmanip;


void main() {
    auto N = readln.chomp.to!int;
    auto X = readln.split.map!(to!int).array;
    auto L = readln.chomp.to!int;

    auto parent = new int[](N);
    int l, r;
    while (l < N) {
        if (l == N-1) {
            parent[l] = N;
            l++;
        }
        else if (r >= N-1) {
            parent[l] = r;
            l++;
        }
        else if (X[l] + L < X[r+1]){
            parent[l] = r;
            l++;
        }
        else {
            r++;
        }
        
    }

    auto depth = new int[](N);
    depth[N-1] = 0;
    int dfs(int n) {
        if (n >= N-1 || depth[n] > 0) return depth[n];
        return depth[n] = dfs(parent[n]) + 1;
    }
    foreach (i; 0..N) dfs(i);

    auto Q = readln.chomp.to!int;
    foreach (i; 0..Q) {
        auto ab = readln.split.map!(to!int).array.sort();
        writeln(max(depth[ab[0]-1] - depth[ab[1]-1], 1));
    }
}
