#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 20;
const int M = 5e2 + 20;
const long long inf = 2e15;
long long n, x[N], L, Q;
int main() {
  while (cin >> n) {
    for (int i = 1; i <= n; i++) scanf("%I64d", &x[i]);
    cin >> L >> Q;
    long long u, v;
    while (Q--) {
      scanf("%I64d%I64d", &u, &v);
      if (u > v) swap(u, v);
      int p = u, q = v, cnt = 0;
      while (p < q) {
        int l = p + 1, r = q;
        while (l <= r) {
          int mid = (l + r) >> 1;
          if (x[mid] - x[p] <= L)
            l = mid + 1;
          else
            r = mid - 1;
        }
        p = l - 1, cnt++;
      }
      printf("%d\n", cnt);
    }
  }
  return 0;
}
