#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int x[maxn];
int main() {
  int N, Q, L, ai, bi;
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &x[i]);
  }
  scanf("%d", &L);
  scanf("%d", &Q);
  for (int i = 1; i <= Q; i++) {
    scanf("%d%d", &ai, &bi);
    int ans = 0;
    if (ai <= bi) {
      int p = ai;
      while (p < bi) {
        int x0 = x[p];
        while (p + 1 <= bi && x[p + 1] - x0 <= L) p++;
        ans++;
      }
    } else {
      int p = ai;
      while (p > bi) {
        int x0 = x[p];
        while (p - 1 >= bi && x0 - x[p - 1] <= L) p--;
        ans++;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
