#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N, L, q;
  cin >> N;
  vector<long long> X(N);
  for (long long i = 0; i < N; i++) cin >> X[i];
  cin >> L >> q;
  long long dp[30][100010];
  long long day[30][100010];
  long long sum[100010] = {0};
  for (long long i = 0; i < N; i++) sum[i + 1] = sum[i] + X[i];
  for (long long i = 0; i < 30; i++)
    for (long long j = 0; j < 100010; j++)
      dp[i][j] = day[i][j] = 1000000000 * 10;
  long long k = 0, s = 0, g = 0;
  while (k < N - 1) {
    while (g != N - 1 && X[g + 1] - X[s] <= L) g++;
    day[0][k] = g - s;
    k++;
    s++;
  }
  for (long long i = 0; i < N - 1; i++) dp[0][i] = X[i + 1] - X[i];
  for (long long i = (1); i < (30); ++i) {
    for (long long j = 0; j < N - 1; j++) {
      if (j + day[i - 1][j] >= N - 1) continue;
      day[i][j] = day[i - 1][j] + day[i - 1][j + day[i - 1][j]];
    }
  }
  for (long long i = 0; i < 30; i++) {
    for (long long j = 0; j < N; j++) {
      if (day[i][j] != 1000000000 * 10) {
      }
    }
  }
  while (q--) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    if (b < a) swap(a, b);
    long long ans = 0;
    long long now = a;
    do {
      bool F = true;
      for (long long i = 25; i >= 0; i--) {
        if (day[i][now] + now <= b) {
          F = false;
          now += (1LL << day[i][now]);
          ans += (1LL << i);
        }
      }
      if (F) {
        cout << ans << endl;
        break;
      } else
        continue;
    } while (1);
  }
  return 0;
}
