#include <bits/stdc++.h>
using namespace std;
long long n;
vector<long long> x;
long long l;
long long q;
vector<long long> a;
vector<long long> b;
void query(long long a, long long b) {
  if (a > b) swap(a, b);
  long long ans = 1;
  long long p = x[a];
  for (long long i = a; i <= b; i++) {
    if (x[i] - p > l) ans++, p = x[i - 1];
  }
  cout << ans << endl;
}
int main(int argc, char const *argv[]) {
  cin >> n;
  x = vector<long long>(n + 1);
  for (long long i = 1; i <= n; i++) cin >> x[i];
  cin >> l;
  cin >> q;
  if (n > 1000 || q > 1000) return 0;
  a = vector<long long>(q);
  b = vector<long long>(q);
  for (long long i = 0; i < q; i++) cin >> a[i] >> b[i];
  for (long long i = 0; i < q; i++) {
    query(a[i], b[i]);
  }
  return 0;
}
