#include <bits/stdc++.h>
using namespace std;
long long N, M, H, W, K, Q, A, B, L, R;
string S, T;
const long long MOD = 998244353;
const long long INF = 1LL << 60;
int main() {
  cin >> N;
  vector<long long> x(N);
  for (int i = 0; i < N; i++) cin >> x[i];
  cin >> L >> Q;
  vector<vector<long long> > dbl(20, vector<long long>(N + 1));
  x.push_back(x[N - 1] + L);
  for (int i = 0; i < N + 1; i++) {
    dbl[0][i] = --upper_bound(x.begin(), x.end(), x[i] + L) - x.begin();
  }
  for (int k = 1; k < 20; k++)
    for (int i = 0; i < N + 1; i++) dbl[k][i] = dbl[k - 1][dbl[k - 1][i]];
  for (int i = 0; i < Q; i++) {
    cin >> A >> B;
    --A;
    --B;
    if (A > B) swap(A, B);
    long long res = 0;
    for (int j = 20 - 1; j >= 0; --j) {
      if (dbl[j][A] <= B) {
        A = dbl[j][A];
        res += (1LL << j);
      }
    }
    cout << res << endl;
  }
}
