macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        v: [usize; n],
        l: usize,
        q: usize,
        qs: [(usize1, usize1); q]
    }
    let mut p = 1;
    while 1 << p <= n {
        p += 1;
    }
    let mut tab = vec![vec![0; p]; n];
    for i in 0..p {
        tab[n - 1][i] = n - 1;
    }
    let mut il = 0;
    let mut ir = 0;
    let mut d = 0;
    while il < n - 1 {
        if ir == n - 1 || d + v[ir + 1] - v[ir] > l {
            tab[il][0] = ir;
            d -= v[il + 1] - v[il];
            il += 1;
        } else {
            d += v[ir + 1] - v[ir];
            ir += 1;
        }
    }
    for i in (0..n - 1).rev() {
        for j in 1..p {
            tab[i][j] = tab[tab[i][j - 1]][j - 1];
        }
    }
    for &(a, b) in &qs {
        let a1 = min(a, b);
        let b1 = max(a, b);
        let mut day = 0;
        let mut x = a1;
        while x < b1 {
            for i in 0..p {
                if tab[x][i] > b1 {
                    day += 1 << (i - 1);
                    x = tab[x][i - 1];
                    break;
                } else if tab[x][i] == b1 {
                    day += 1 << i;
                    x = tab[x][i];
                    break;
                }
            }
        }
        println!("{}", day);
    }
}
