#include <bits/stdc++.h>
const int N = 2e5 + 100;
using namespace std;
int a[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  while (cin >> n) {
    for (int i = 1; i <= n; i++) cin >> a[i];
    int L;
    cin >> L;
    int q;
    cin >> q;
    while (q--) {
      int x, y;
      cin >> x >> y;
      if (x > y) swap(x, y);
      int ans = 0;
      int pre = x;
      for (int i = x + 1; i <= y; i++) {
        if (a[i] - a[pre] > L) {
          ans++;
          i--;
          pre = i;
        }
      }
      cout << ans + 1 << endl;
    }
  }
  return 0;
}
