#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;
int main() {
  int n;
  cin >> n;
  std::vector<int> x(n);
  for (int i = 0; i < n; i++) cin >> x[i];
  int L, Q;
  cin >> L >> Q;
  std::vector<std::vector<int>> dp(n, std::vector<int>(20, -1));
  for (int i = 0; i < n; i++) {
    int tmp = 0;
    for (int j = i; j < n - 1; j++) {
      if (tmp + x[j + 1] - x[j] <= L)
        tmp += x[j + 1] - x[j];
      else {
        dp[i][0] = j;
        break;
      }
    }
    if (dp[i][0] == -1) dp[i][0] = n - 1;
  }
  for (int k = 1; k < 20; k++) {
    for (int i = 0; i < n; i++) {
      dp[i][k] = dp[dp[i][k - 1]][k - 1];
    }
  }
  for (int q = 0; q < Q; q++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    if (a > b) std::swap(a, b);
    int ans = 0, now = a;
    while (true) {
      int k = lower_bound(begin(dp[now]), end(dp[now]), b) - begin(dp[now]);
      if (dp[now][k] == b) {
        ans += (1 << k);
        break;
      }
      if (--k < 0) break;
      ans += (1 << k);
      now = dp[now][k];
    }
    cout << ans << endl;
  }
  return 0;
}
