#include <bits/stdc++.h>
using namespace std;
int N, L, Q, A, B;
int hotels[1005];
int main() {
  scanf("%d", &N);
  for (int n = 1; n <= N; n++) {
    scanf("%d", &hotels[n]);
  }
  scanf("%d", &L);
  scanf("%d", &Q);
  for (int q = 0; q < Q; q++) {
    scanf("%d %d", &A, &B);
    int numdays = 0;
    int dist = 0;
    for (int a = min(A, B); a < max(A, B); a++) {
      if (dist + hotels[a + 1] - hotels[a] <= L) {
        dist += hotels[a + 1] - hotels[a];
      } else {
        dist = hotels[a + 1] - hotels[a];
        numdays++;
      }
    }
    printf("%d\n", numdays + 1);
  }
}
