#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> x(n);
  for (int i = 0; i < n; ++i) {
    cin >> x[i];
  }
  int l, q;
  cin >> l >> q;
  const int cached = 30;
  vector<vector<int>> hotel_dist(cached, vector<int>(n + 1));
  for (int i = 0; i < n; ++i) {
    hotel_dist[0][i] =
        lower_bound(x.begin(), x.end(), x[i] + l + 1) - x.begin() - 1;
  }
  for (int i = 1; i < cached; ++i) {
    for (int j = 0; j < n; ++j) {
      hotel_dist[i][j] = hotel_dist[i - 1][hotel_dist[i - 1][j]];
    }
  }
  cerr << "ok\n";
  for (int i = 0; i < q; ++i) {
    int start, goal;
    cin >> start >> goal;
    if (goal < start) swap(start, goal);
    int days = 1;
    for (int i = cached - 1; 0 <= i; --i) {
      if (hotel_dist[i][start] < goal) {
        days += (1 << i);
        start = hotel_dist[i][start];
      }
    }
    cout << days << endl;
  }
}
