#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> V(N);
  for (int &v : V) cin >> v;
  int Q, L;
  cin >> L >> Q;
  for (int i = 0; i < Q; ++i) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    if (a > b) swap(a, b);
    int c = 0, s = 0;
    for (int j = a + 1; j <= b; ++j) {
      int t = V[j] - V[j - 1];
      if (s + t > L) {
        c++;
        s = 0;
      }
      s += t;
    }
    if (s) {
      c++;
    }
    cout << c << endl;
  }
}
