#include <bits/stdc++.h>
using namespace std;
using VS = vector<string>;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using PLL = pair<LL, LL>;
using VL = vector<LL>;
using VVL = vector<VL>;
const int INF = 1e9;
const LL LINF = 1e16;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
int DX[8] = {0, 0, 1, -1, 1, 1, -1, -1};
int DY[8] = {1, -1, 0, 0, 1, -1, 1, -1};
LL N, L, Q;
LL ans = 0LL;
LL dist[100005][40];
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cin >> N;
  VL x(N, 0);
  for (int(i) = (0); (i) < (N); (i)++) {
    cin >> x[i];
  }
  for (int(i) = (0); (i) < (100005); (i)++)
    for (int(j) = (0); (j) < (40); (j)++) dist[i][j] = -1;
  cin >> L >> Q;
  for (int(i) = (0); (i) < (N - 1); (i)++) {
    int id = upper_bound(begin((x)), end((x)), x[i] + L) - x.begin();
    id--;
    if (i < id && id < N) {
      dist[i][0] = id;
    }
  }
  for (int(i) = (0); (i) < (39); (i)++) {
    for (int(j) = (0); (j) < (N); (j)++) {
      if (dist[j][i] != -1 && dist[j][i] > j && dist[j][i] < N)
        if (dist[dist[j][i]][i] > j) dist[j][i + 1] = dist[dist[j][i]][i];
    }
  }
  for (int(i) = (0); (i) < (Q); (i)++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    if (a > b) swap(a, b);
    ans = 0;
    int pos = a;
    for (int(k) = (39); (k) > (-1); (k)--) {
      int nx = dist[pos][k];
      if (nx < 1) continue;
      if (nx <= b && pos < nx) {
        pos = nx;
        ans += 1 << (k);
        if (pos == b) break;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
