#include <bits/stdc++.h>
using namespace std;
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> hotels(N);
  for (int i = 0; i < (int)(N); i++) cin >> hotels[i];
  int L, Q;
  cin >> L >> Q;
  vector<int> A(Q), B(Q);
  for (int i = 0; i < (int)(Q); i++) cin >> A[i] >> B[i], A[i]--, B[i]--;
  assert(N <= 1000 and Q <= 1000);
  for (int i = 0; i < (int)(Q); i++) {
    int a = A[i], b = B[i];
    vector<int> x(abs(a - b) + 1, 0);
    if (a < b) {
      for (int j = b; j >= a; j--) x[b - j] = hotels[b] - hotels[j];
    } else {
      for (int j = b; j < (int)(a + 1); j++) x[j - b] = hotels[j] - hotels[b];
    }
    int M = x.size();
    vector<int> dp(M, -1);
    dp[0] = 0;
    for (int j = 0; j < (int)(M); j++) {
      auto c = lower_bound(x.begin(), x.end(), x[j] + L);
      if (c == x.end()) {
        cout << dp[j] + 1 << endl;
        break;
      }
      int idx = c - x.begin();
      if (x[idx] > x[j] + L) idx--;
      if (idx >= M - 1) {
        cout << dp[j] + 1 << endl;
        break;
      }
      while (dp[idx] == -1) dp[idx] = dp[j] + 1, idx--;
    }
  }
  return 0;
}
