#include <bits/stdc++.h>
using namespace std;
int arr[132000];
int brr[132000], L;
struct node {
  int sum, l_cost, r_cost;
} seg[132000 << 1];
node merge(node lch, node rch) {
  node ret;
  if (lch.r_cost + rch.l_cost > L) {
    ret.sum = lch.sum + rch.sum;
    ret.l_cost = lch.l_cost;
    ret.r_cost = rch.r_cost;
  } else {
    ret.sum = lch.sum + rch.sum - 1;
    if (lch.sum == 1)
      ret.l_cost = lch.l_cost + rch.l_cost;
    else
      ret.l_cost = lch.l_cost;
    if (rch.sum == 1)
      ret.r_cost = rch.r_cost + lch.r_cost;
    else
      ret.r_cost = rch.r_cost;
  }
  return ret;
}
void build(int l, int r, int p) {
  if (l == r) {
    seg[p].sum = 1;
    seg[p].l_cost = seg[p].r_cost = brr[l];
  } else {
    int mid = (l + r) >> 1, lch = p << 1, rch = p << 1 | 1;
    build(l, mid, lch);
    build(mid + 1, r, rch);
    seg[p] = merge(seg[lch], seg[rch]);
  }
}
node query(int l, int r, int ql, int qr, int p) {
  if (l == ql && r == qr)
    return seg[p];
  else {
    int mid = (l + r) >> 1, lch = p << 1, rch = p << 1 | 1;
    if (qr <= mid)
      return query(l, mid, ql, qr, lch);
    else if (ql > mid)
      return query(mid + 1, r, ql, qr, rch);
    else
      return merge(query(l, mid, ql, mid, lch),
                   query(mid + 1, r, mid + 1, qr, rch));
  }
}
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--;
  cin >> L;
  build(1, n, 1);
  int q;
  cin >> q;
  while (q--) {
    int l, r;
    cin >> l >> r;
    if (l > r) swap(l, r);
    cout << query(1, n, l, r - 1, 1).sum << endl;
  }
  return 0;
}
