#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N, L, Q;
  cin >> N;
  vector<int> x(N);
  for (int i = 0; i < N; i++) cin >> x[i];
  x.push_back(2e9);
  cin >> L >> Q;
  vector<int> a(Q), b(Q);
  for (int i = 0; i < Q; i++) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    if (a[i] > b[i]) swap(a[i], b[i]);
  }
  vector<vector<int>> next(N, vector<int>(17));
  for (int i = 0; i < N; i++) {
    next[i][0] = upper_bound(x.begin(), x.end(), x[i] + L) - x.begin() - 1;
  }
  for (int j = 0; j < 16; j++) {
    for (int i = 0; i < N; i++) {
      next[i][j + 1] = next[next[i][j]][j];
    }
  }
  for (int i = 0; i < Q; i++) {
    int ans = 1;
    for (int j = 16; j >= 0; j--) {
      if (next[a[i]][j] >= b[i]) continue;
      ans += 1 << j;
      a[i] = next[a[i]][i];
    }
    cout << ans << "\n";
  }
}
