#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using MATRIX = vector<vector<ll> >;
int N, L, Q;
int x[100000];
vector<P> query;
int nxt[20][100000];
int NUM;
const int INF = 1000000000;
int calc(int a, int key) {
  int temp = a;
  for (int i = NUM; i >= 0; i--) {
    if ((key >> i) & 1) {
      temp = nxt[i][temp];
      if (temp == INF) return temp;
    }
  }
  return temp;
}
int isOk(int a, int b, int key) {
  if (calc(a, key) >= b) return true;
  return false;
}
int lower_search(int a, int b) {
  int l = -1, r = N;
  while (r - l > 1) {
    int half = (r + l) / 2;
    if (isOk(a, b, half))
      r = half;
    else
      l = half;
  }
  return r;
}
int main() {
  cin >> N;
  NUM = floor(log2(N));
  for (int i = 0; i < (int)(NUM + 1); ++i) {
    for (int j = 0; j < (int)(N); ++j) {
      nxt[i][j] = INF;
    }
  }
  for (int i = 0; i < (int)(N); ++i) {
    cin >> x[i];
  }
  cin >> L;
  cin >> Q;
  for (int i = 0; i < (int)(Q); ++i) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    query.push_back({a, b});
  }
  int srt = 0;
  int end = 1;
  while (true) {
    if (srt == N - 1) break;
    if (x[end] - x[srt] > L) {
      nxt[0][srt] = end - 1;
      srt++;
    } else {
      end++;
      if (end >= N) {
        nxt[0][srt] = end - 1;
        srt++;
      }
    }
  }
  for (int i = 0; i < (int)(NUM); ++i) {
    for (int j = 0; j < (int)(N); ++j) {
      if (nxt[i][j] == INF)
        nxt[i + 1][j] = INF;
      else {
        nxt[i + 1][j] = nxt[i][nxt[i][j]];
      }
    }
  }
  for (int i = 0; i < (int)(Q); ++i) {
    int u = query[i].first;
    int v = query[i].second;
    if (u > v) swap(u, v);
    cout << lower_search(u, v) << endl;
  }
  return 0;
}
