#include <bits/stdc++.h>
int main() {
  int i, j, N, x[100002], right[100001], L, q, Q, l, r, ans, tmp;
  scanf("%d", &N);
  for (i = 1; i <= N; i++) scanf("%d", &(x[i]));
  scanf("%d", &L);
  x[N + 1] = x[N] + L + 1;
  for (i = N - 1, right[N] = N; i >= 1; i--) {
    for (j = i + 2, tmp = x[i] + L; x[j] <= tmp; j++)
      ;
    right[i] = j - 1;
  }
  scanf("%d", &Q);
  for (q = 1; q <= Q; q++) {
    scanf("%d %d", &l, &r);
    if (l > r) {
      l ^= r;
      r ^= l;
      l ^= r;
    }
    for (ans = 0; l < r; l = right[l], ans++)
      ;
    printf("%d\n", ans);
  }
  fflush(stdout);
  return 0;
}
