#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int s[maxn], n, L, Q;
int main() {
  s[0] = 0;
  while (~scanf("%d", &n)) {
    for (int i = 1; i <= n; i++) scanf("%d", &s[i]);
    scanf("%d", &L);
    scanf("%d", &Q);
    while (Q--) {
      int a, b, sum = 0, ans = 0;
      scanf("%d%d", &a, &b);
      if (a > b) swap(a, b);
      int i;
      for (i = b; i > a; i--) {
        sum += (s[i] - s[i - 1]);
        if (sum >= L) {
          ans++;
          sum = (s[i] - s[i - 1]);
        }
      }
      if (s[i + 1] - s[i] == sum) ans++;
      printf("%d\n", ans);
    }
  }
  return 0;
}
