#include <bits/stdc++.h>
using namespace std;
int N, L, Q;
vector<int> x;
int main() {
  cin >> N;
  x.resize(N);
  for (int& s : x) cin >> s;
  cin >> L >> Q;
  if (N > 1000 || Q > 1000) throw 1;
  for (int i = 0; i < Q; ++i) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    int p = a < b ? 1 : -1;
    int d = 1;
    long long e = 0;
    for (int j = a; j != b; j += p) {
      int f = abs(x[j] - x[j + p]);
      if (e + f <= L) {
        e += f;
      } else {
        e = f;
        ++d;
      }
    }
    cout << d << endl;
  }
}
