#include <bits/stdc++.h>
using namespace std;
int N;
long long x[100000 + 10];
long long L;
long long dp[100000 + 10];
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> x[i], dp[i] = 1145141919;
  cin >> L;
  long long npos = x[0], nday = 0;
  dp[0] = 0;
  for (int i = 1; i < N; i++) {
    if (npos + L >= x[i])
      dp[i] = nday + 1;
    else {
      nday++;
      npos = x[i - 1];
      dp[i] = nday + 1;
    }
  }
  int Q;
  cin >> Q;
  for (int i = 0; i < Q; i++) {
    int a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    int ans = dp[b - 1] - dp[a - 1];
    if (dp[a] == dp[a - 1]) ans++;
    cout << ans << endl;
  }
  return 0;
}
