#include <bits/stdc++.h>
using namespace std;
void solve() {
  int N, L, Q;
  cin >> N;
  vector<int> xs(N), imos(N);
  for (int i = 0; i < N; i++) {
    cin >> xs[i];
  }
  cin >> L >> Q;
  int cnt = 0, pos = xs[0];
  for (int i = 1; i < N; i++) {
    if (pos < xs[i]) {
      pos = xs[i - 1] + L;
      cnt++;
    }
    imos[i] = cnt;
  }
  while (Q--) {
    int a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    a--, b--;
    cout << imos[b] - imos[a - 1] << endl;
  }
}
int main(void) {
  solve();
  return 0;
}
