#include <bits/stdc++.h>
using namespace std;
int N, L;
int X[100004];
int solve(int a, int b) {
  if (a > b) swap(a, b);
  int res = 0;
  int p = a;
  while (p < b) {
    int upto = X[p] + L;
    while (p <= N && X[p] <= upto) ++p;
    --p;
    ++res;
  }
  return res;
}
int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N;
  for (int i = 1; i <= N; ++i) cin >> X[i];
  cin >> L;
  int Q;
  cin >> Q;
  for (int q = 0; q < Q; ++q) {
    int a, b;
    cin >> a >> b;
    int res = solve(a, b);
    cout << res << '\n';
  }
  return 0;
}
