#include <bits/stdc++.h>
using namespace std;
vector<int> x;
int a[200005], b[200005];
vector<int> G[200005];
int f[200005][2];
int main() {
  int n;
  cin >> n;
  x.push_back(-1);
  for (int i = 1; i < n + 1; ++i) {
    int x_;
    cin >> x_;
    x.push_back(x_);
  }
  int l, q;
  cin >> l >> q;
  for (int i = 0; i < (q); ++i) {
    cin >> a[i] >> b[i];
    if (a[i] > b[i]) swap(a[i], b[i]);
  }
  for (int i = 1; i < n + 1; ++i) {
    if (f[i][0] == 0) {
      f[i][0] = i;
      G[i].push_back(i);
      int now = i;
      int day = 1;
      while (true) {
        int ma = x[now] + l;
        auto ite = upper_bound(x.begin(), x.end(), ma);
        if (ite - x.begin() == n + 1) {
          if (f[n][0] == 0) {
            f[n][0] = i;
            f[n][1] = day;
            G[i].push_back(n);
            break;
          } else {
            G[i].push_back(n);
            break;
          }
        } else {
          if (f[ite - x.begin() - 1][0] == 0) {
            f[ite - x.begin() - 1][0] = i;
            f[ite - x.begin() - 1][1] = day;
            G[i].push_back(ite - x.begin() - 1);
            now = ite - x.begin() - 1;
            day++;
          } else {
            G[i].push_back(ite - x.begin() - 1);
            break;
          }
        }
      }
    }
  }
  for (int i = 0; i < (q); ++i) {
    int day = 0;
    int now[2];
    now[0] = f[a[i]][0];
    now[1] = f[a[i]][1];
    while (true) {
      int j = now[0];
      int k = now[1];
      if (G[j][G[j].size() - 1] < b[i]) {
        day += G[j].size() - k;
        now[0] = f[G[j][G[j].size() - 1]][0];
        now[1] = f[G[j][G[j].size() - 1]][1];
      } else {
        break;
      }
    }
    while (true) {
      if (G[now[0]][now[1] + 1] < b[i]) {
        day++;
        now[1]++;
      } else {
        day++;
        break;
      }
    }
    cout << day << endl;
  }
  return 0;
}
