#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int N;
  cin >> N;
  vector<long long> X(N);
  vector<long long> FOR(N);
  vector<long long> BACK(N);
  for (int i = 0; i < N; i++) cin >> X[i];
  long long L;
  cin >> L;
  vector<long long> POS(N);
  for (int i = 0; i < N - 1; i++) {
    int left = i + 1;
    int right = N;
    while (right - left > 1) {
      int mid = (left + right) / 2;
      if (X[mid] - X[i] <= L)
        left = mid;
      else
        right = mid;
    }
    POS[i] = left;
  }
  int curr = 0;
  int Days = 1;
  while (curr < N - 1) {
    curr = POS[curr];
    FOR[curr] = Days;
    BACK[curr] = Days;
    Days++;
  }
  int CF = 1;
  int CB = 0;
  for (int i = 0; i < N; i++) {
    if (FOR[i] == 0)
      FOR[i] = CF, BACK[i] = CB;
    else {
      CF++;
      CB++;
    }
  }
  int Q;
  int a, b;
  cin >> Q;
  for (int i = 0; i < Q; i++) {
    cin >> a >> b;
    a--;
    b--;
    if (a > b) {
      long long temp = b;
      b = a;
      a = temp;
    }
    int t = POS[POS[a]];
    long long temp = (X[t] - X[a]) / L;
    cout << FOR[b] - FOR[t] + temp + 1 << endl;
  }
}
