#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  scanf("%d", &N);
  vector<int> x(N);
  vector<int> dist(N);
  for (int i = 0; i < N; i++) {
    scanf("%d ", &x[i]);
    if (x[i] != 0) dist[i] = x[i] - x[i - 1];
  }
  int L, Q;
  scanf("%d\n%d", &L, &Q);
  int maxday = x[N - 1] - x[0] + 1;
  vector<vector<int>> distday(maxday + 1, vector<int>(N));
  for (int i = 0; i < N; i++) {
    if (i != N - 1) distday[1][i] = i + 1;
    distday[0][i] = i;
  }
  int sum = 0;
  bool check = true;
  int ie = 0;
  for (int i = 0; i < N; i++) {
    check = true;
    if (i > 0) sum -= dist[i];
    while (check) {
      ie++;
      if (ie == N) {
        ie--;
        break;
      }
      sum += dist[ie];
      if (sum > L) {
        sum -= dist[ie];
        check = false;
        ie--;
      }
      distday[1][i] = ie;
    }
  }
  for (int a, b, i = 0; i < Q; i++) {
    scanf("%d %d", &a, &b);
    a--;
    b--;
    if (a > b) swap(a, b);
    int ed = a, days = 0;
    while (ed < b) {
      days++;
      ed = distday[1][ed];
    }
    printf("%d\n", days);
  }
}
