#include <bits/stdc++.h>
using namespace std;
long long powl[35];
long long x[100004];
long dp[33][100004];
int main() {
  powl[0] = 1;
  for (long i = 1; i <= 32; i++) powl[i] = powl[i - 1] * 2LL;
  long n;
  cin >> n;
  for (long i = 1; i <= n; i++) {
    cin >> x[i];
  }
  long l, q;
  cin >> l >> q;
  for (long j = 1; j < n; j++) {
    long l1 = j;
    long r = n;
    while (r - l1 > 1) {
      long mid = (l1 + r) / 2;
      if (x[mid] - x[j] <= l)
        l1 = mid;
      else
        r = mid;
    }
    dp[0][j] = l1;
    if (x[n] - x[j] <= l) {
      dp[0][j] = n;
    }
  }
  dp[0][n] = n + 1;
  long d = 1;
  for (long i = 2; i <= n; i = i * 2LL) {
    for (long j = 1; j <= n; j++) {
      if (dp[d - 1][j] > n) {
        dp[d][j] = n + 1;
        continue;
      }
      dp[d][j] = dp[d - 1][dp[d - 1][j]];
    }
    d++;
  }
  d--;
  for (long i = 1; i <= q; i++) {
    long a, b;
    cin >> a >> b;
    if (b < a) {
      a = a + b;
      b = a - b;
      a = a - b;
    }
    long long int ans = 0;
    for (long j = d; j >= 0; j--) {
      long f = dp[j][a];
      if (f <= b) {
        a = f;
        ans += powl[j];
      }
    }
    cout << ans << endl;
  }
}
