#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, L, Q;
  cin >> N;
  vector<int> x(N);
  for (int(i) = (0); (i) < (int)(N); ++(i)) scanf("%d", &x[i]);
  cin >> L >> Q;
  if (N > 1000 || Q > 1000) return 0;
  while (Q--) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a;
    --b;
    if (a > b) swap(a, b);
    int rem = L, ans = 1;
    for (int(i) = (a); (i) < (int)(b); ++(i)) {
      if (rem - (x[i + 1] - x[i]) < 0) {
        rem = L - (x[i + 1] - x[i]);
        ans++;
      } else {
        rem -= x[i + 1] - x[i];
      }
    }
    printf("%d\n", ans);
  }
}
