#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;
using vll = vector<pll>;
template <class t, class u>
void chmax(t& a, u b) {
  if (a < b) a = b;
}
template <class t, class u>
void chmin(t& a, u b) {
  if (b < a) a = b;
}
const int inf = (1 << 28);
const ll infl = (1LL << 60);
int main() {
  int N, L, Q;
  cin >> N;
  vl x(N);
  for (int x_i = 0; x_i < (N); ++x_i) cin >> x[x_i];
  vvl dp(N, vl(50));
  cin >> L >> Q;
  for (int i = 0; i < (N); ++i) {
    dp[i][0] = upper_bound((x).begin(), (x).end(), x[i] + L) - x.begin() - 1;
  }
  for (int k = 0; k < (40); ++k)
    for (int i = 0; i < (N); ++i) {
      dp[i][k + 1] = dp[dp[i][k]][k];
    }
  for (int i = 0; i < (Q); ++i) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    if (a > b) swap(a, b);
    if (dp[a][0] >= b) {
      cout << 1 << endl;
      continue;
    }
    ll ans = 1;
    while (true) {
      int k = 0;
      while (dp[a][k + 1] < b) k++;
      a = dp[a][k];
      ans += pow(2, k);
      if (k == 0) break;
    }
    cout << ans << endl;
  }
  return 0;
}
