#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const char ENDL = '\n';
signed main(void) {
  ios::sync_with_stdio(false);
  cout.setf(ios::fixed, ios::floatfield);
  cout.precision(10);
  cin.tie(0);
  long long n, l, q;
  cin >> n;
  vector<long long> x(n);
  for (long long i = (0); i < (n); ++i) {
    cin >> x[i];
  }
  cin >> l >> q;
  vector<long long> a(q), b(q);
  for (long long i = (0); i < (q); ++i) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
  }
  for (long long i = (0); i < (q); ++i) {
    if (a[i] > b[i]) {
      swap(a[i], b[i]);
    }
    long long ans = 1, t = a[i];
    for (long long j = (t + 1); j < (b[i] + 1); ++j) {
      if (x[j] - x[t] > l) {
        ans++;
        t = j - 1;
        j--;
      }
    }
    cout << ans << ENDL;
  }
  return 0;
}
