#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int mod998 = 998244353;
int N, L, Q, x[100000], a, b, p, l[100000][17], r[100000][17];
int fl(int x) {
  if (x == -1) {
    return (a != b);
  }
  if (l[a][x] > b) {
    return fl(x - 1);
  } else {
    a = l[a][x];
    return (1 << x) + fl(x - 1);
  }
}
int fr(int x) {
  if (x == -1) {
    return (a != b);
  }
  if (r[a][x] < b) {
    return fr(x - 1);
  } else {
    a = r[a][x];
    return (1 << x) + fr(x - 1);
  }
  return 0;
}
int main() {
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> x[i];
  }
  cin >> L >> Q;
  for (int i = 0; i < N; ++i) {
    for (; p < N && x[p] <= x[i] + L; ++p)
      ;
    l[i][0] = p - 1;
  }
  p = N - 1;
  for (int i = N - 1; i >= 0; --i) {
    for (; p >= 0 && x[i] - L <= x[p]; --p)
      ;
    r[i][0] = p + 1;
  }
  for (int i = 1; i < 17; ++i) {
    for (int j = 0; j < N; ++j) {
      l[j][i] = l[l[j][i - 1]][i - 1];
      r[j][i] = r[r[j][i - 1]][i - 1];
    }
  }
  while (Q--) {
    cin >> a >> b;
    --a;
    --b;
    if (a < b) {
      cout << fl(16) << endl;
    } else {
      cout << fr(16) << endl;
    }
  }
  return 0;
}
