//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

//

use std::io::Write;

fn run() {
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());
    input! {
        n: usize,
        x: [u32; n],
        l: u32,
        q: usize,
        p: [(usize1, usize1); q],
    }
    let mut dp = vec![0; n];
    let mut j = 0;
    for i in 0..n {
        while j < n - 1 && x[j + 1] - x[i] <= l {
            j += 1;
        }
        dp[i] = j;
    }
    let mut dp = vec![dp];
    while dp.last().unwrap()[0] < n - 1 {
        let mut next = vec![0; n];
        let prev = dp.last().unwrap();
        for i in 0..n {
            next[i] = prev[prev[i]];
        }
        dp.push(next);
    }
    for (a, b) in p {
        let (mut a, b) = (std::cmp::min(a, b), std::cmp::max(a, b));
        let mut ans = 0;
        for i in (0..dp.len()).rev() {
            if dp[i][a] < b {
                ans += 1 << i;
                a = dp[i][a];
            }
        }
        ans += 1;
        writeln!(out, "{}", ans).unwrap();
    }
}

fn main() {
    run();
}
