#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6;
const long long LINF = 1e18;
long long int n, cnt = 0, ans = 0, a, b, c, d, cmp, cmpp, m, h, w, x[ohara], y,
                 sum = 0, pos, l, Q;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
bool fl = true;
struct edge {
  int to, cost;
};
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  for (long long int(i) = 0; (i) < (int)(n); (i)++) {
    cin >> x[i];
  }
  cin >> l >> Q;
  for (long long int(i) = 0; (i) < (int)(Q); (i)++) {
    cnt = 0;
    long long le, ri, now;
    cin >> le >> ri;
    le--;
    ri--;
    if (le < ri) {
      now = x[le];
      for (long long int j = (le); j < (ri + 1); j++) {
        if (x[j] - now > l) {
          j--;
          now = x[j];
          cnt++;
        }
      }
    } else {
      now = x[le];
      for (long long int j = (le); j >= (ri); j--) {
        if (now - x[j] > l) {
          j++;
          now = x[j];
          cnt++;
        }
      }
    }
    cout << (cnt + 1) << endl;
    cnt = 0;
  }
  return 0;
}
