#include <bits/stdc++.h>
int N, a[100011], L;
int Q;
int d[17][100011];
int lo(int x) {
  int l, m, h;
  l = 0;
  h = N - 1;
  while (l < h) {
    m = (l + h) >> 1;
    if ((a[m] <= x && (m + 1 == N || a[m + 1] > x)))
      return m;
    else if (a[m] < x)
      l = m + 1;
    else
      h = m - 1;
  }
  return l;
}
int main() {
  int i, j;
  int s, e;
  int days;
  scanf("%d", &N);
  for (i = 0; i < N; i++) scanf("%d", &a[i]);
  scanf("%d%d", &L, &Q);
  for (j = 0; j < N; j++) {
    d[0][j] = lo(a[j] + L);
  }
  for (i = 1; i < 17; i++) {
    for (j = 0; j < N; j++) {
      d[i][j] = d[i - 1][d[i - 1][j]];
    }
  }
  for (i = 0; i < Q; i++) {
    scanf("%d%d", &s, &e);
    j = 16;
    days = 0;
    s--;
    e--;
    if (s > e) s ^= e ^= s ^= e;
    while (s < e) {
      while (j > 0 && d[j][s] > e) j--;
      days += (1 << j);
      s = d[j][s];
    }
    printf("%d\n", days);
  }
}
