#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

ll x[100001];
ll dif[100001];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; 
	cin >> n;
	for(int i = 0; i < n; i++)
	{
		cin >> x[i];
		if(i > 0) dif[i] = x[i] - x[i - 1];
	}
	ll d; int q;
	cin >> d >> q;
	while(q--)
	{
		int l, r; cin >> l >> r;
		l--; r--;
		if(l > r) swap(l, r);
		int idx = l; int days = 1; int sum = 0;
		while(idx < r)
		{
			sum += dif[idx+1];
			if(sum > d)
			{
				days++; sum = dif[idx+1];
			}
			idx++;
		}
		cout << days << '\n';
	}
}
