#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 ans = 0LL;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  LL N;
  cin >> N;
  VL x(N);
  for (int(i) = (0); (i) < (N); (i)++) {
    cin >> x[i];
  }
  LL L, Q;
  cin >> L >> Q;
  VVL d(N, VL(31, -1));
  for (int(i) = (0); (i) < (N); (i)++) {
    int id = lower_bound(begin((x)), end((x)), x[i] + L) - x.begin();
    if (x[id] - x[i] > L) id--;
    d[i][0] = id;
  }
  for (int(i) = (0); (i) < (30); (i)++) {
    for (int(j) = (0); (j) < (N); (j)++) {
      d[j][i + 1] = d[d[j][i]][i];
    }
  }
  for (int(_) = (0); (_) < (Q); (_)++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    if (a > b) swap(a, b);
    ans = 0;
    ;
    for (int(i) = (30); (i) > (0 - 1); (i)--) {
      if (b > d[a][i]) {
        ans += 1 << i;
        a = d[a][i];
        ;
      }
    }
    cout << ans + 1 << "\n";
  }
  return 0;
}
