#include <bits/stdc++.h>
using namespace std;
int mark[200000], flag[200000], a[200000];
int main() {
  int n, l, q, x, y;
  while (~scanf("%d", &n)) {
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    scanf("%d", &l);
    int res = 1, sum = 0;
    for (int i = 1, j; i <= n;) {
      sum = 0;
      for (j = i; j <= n; j++) {
        sum += a[j] - a[j - 1];
        if (sum > l) break;
      }
      for (int k = i; k < j; k++) mark[k] = res, flag[k] = j - 1;
      res++;
      i = j;
    }
    scanf("%d", &q);
    while (q--) {
      scanf("%d%d", &x, &y);
      if (x > y) swap(x, y);
      if (flag[x] == x) {
        cout << mark[y] - mark[x] << endl;
      } else {
        int sum = 0, res = 1, ans = -1;
        for (int i = x; i <= y; i++) {
          sum += a[i] - a[i - 1];
          if (sum > l) {
            if (flag[i - 1] == i - 1)
              ans = res + mark[y] - mark[i - 1];
            else
              res++;
            sum = 0;
          }
          if (ans != -1) break;
        }
        if (ans == -1) ans = res;
        cout << ans << endl;
      }
    }
  }
  return 0;
}
