#include <bits/stdc++.h>
using namespace std;
int arr[100005], brr[100005];
struct sqrtd {
  int next, cnt;
} table[100005];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  for (int i = 1; i < n; i++) brr[i] = arr[i + 1] - arr[i];
  n--;
  int L;
  cin >> L;
  int box = sqrt(n);
  for (int i = 1; i <= n; i++) {
    int tem_cnt = 0, bound = min((i / box + 1) * box, n), j;
    for (j = i; j <= bound;) {
      int sum = 0;
      do {
        sum += brr[j++];
      } while (j <= n && sum + brr[j] <= L);
      tem_cnt++;
    }
    table[i] = {j, tem_cnt};
  }
  int q;
  cin >> q;
  while (q--) {
    int l, r;
    cin >> l >> r;
    if (l > r) swap(l, r);
    r--;
    int ans = 0;
    while (l <= r && l / box != r / box) {
      ans += table[l].cnt;
      l = table[l].next;
    }
    if (l <= r && l / box == r / box) {
      while (l <= r) {
        int sum = 0;
        do {
          sum += brr[l++];
        } while (l <= r && sum + brr[l] <= L);
        ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
