#include <bits/stdc++.h>
using namespace std;
int N, L, Q;
int A[200010];
vector<long long> adj[200010];
int twok[200010][100], depth[200010], dist[200010][100];
void twokdecomp(int x, int p) {
  twok[x][0] = p;
  for (int i = 1; i <= 18; i++) {
    if (twok[x][i - 1] == -1) break;
    twok[x][i] = twok[twok[x][i - 1]][i - 1];
    dist[x][i] = dist[x][i - 1] + dist[twok[x][i - 1]][i - 1];
  }
  for (auto i : adj[x]) {
    if (i != p) {
      depth[i] = depth[x] + 1;
      dist[i][0] = 1;
      twokdecomp(i, x);
    }
  }
}
pair<long long, long long> kth_parent(int x, int k) {
  int distans = 0;
  for (int i = 0; i <= 17; i++) {
    if (k & (1 << i)) {
      x = twok[x][i];
      distans += dist[x][i];
    }
    if (x == -1) break;
  }
  return pair<long long, long long>(x, distans);
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  cin >> N;
  for (long long i = 1; i <= long long(N); ++i) cin >> A[i];
  cin >> L >> Q;
  for (long long i = 1; i <= long long(N - 1); ++i) {
    if (A[i + 1] - A[i] > L) continue;
    int idx = lower_bound(A + 1, A + N + 1, A[i] + L) - A;
    if (idx == N + 1 || A[idx] > A[i] + L) idx--;
    adj[i].push_back(idx);
    adj[idx].push_back(i);
  }
  dist[N][0] = -1;
  memset(twok, -1, sizeof twok);
  twokdecomp(N, -1);
  cout << kth_parent(1, 3).first;
  for (long long i = 0; i <= long long(Q - 1); ++i) {
    int a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    int l = 0, r = 200010;
    while (l + 1 < r) {
      int mid = (l + r) / 2;
      if (kth_parent(a, mid).first == -1)
        r = mid;
      else if (kth_parent(a, mid).first > b)
        r = mid;
      else
        l = mid;
    }
    cout << l << '\n';
  }
}
