N = gets.to_i
X = gets.split(/ /).collect{|x| x.to_i}
L = gets.to_i
Q = gets.to_i
queries = []

d_list = []
(0...X.length - 1).each{|i|
	d_list << X[i + 1] - X[i]
}

#p d_list


Q.times{
	a, b = gets.split(/ /).collect{|x| x.to_i}
	
	a -= 1
	b -= 1
	
#	p [a, b]
	
	count = 1
	len = 0
	if a < b
		i = a
		while i < b
			len += d_list[i]
			i += 1
			if len > L
				i -= 1
				len = 0
				count += 1
			end
		end
	else
		i = a
		while i > b
			i -= 1
			len += d_list[i]
			if len > L
				i += 1
				len = 0
				count += 1
			end
		end
	end
	p count
}

