#include <bits/stdc++.h>
using namespace std;
const long long INF = 1l << 60;
long long N;
long long X[100100];
long long L, Q;
long long d[20][100100];
signed main() {
  cin >> N;
  for (long long i = 0; i < (N); ++i) {
    cin >> X[i];
  }
  X[N] = X[N - 1] + 1;
  N++;
  cin >> L >> Q;
  for (long long i = 0; i < (N); ++i) {
    d[0][i] = lower_bound(X, X + N, X[i] + L + 1) - X - 1;
  }
  for (long long i = 0; i < (19); ++i) {
    for (long long j = 0; j < (N); ++j) {
      d[i + 1][j] = d[i][d[i][j]];
    }
  }
  for (long long i = 0; i < (Q); ++i) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    if (a > b) swap(a, b);
    long long x = a;
    long long ans = 0;
    for (long long j = 19; j >= 0; --j) {
      if (d[j][x] == b) {
        ans += 1ll << j;
        break;
      } else if (d[j][x] < b) {
        x = d[j][x];
        ans += 1ll << j;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
