#include <bits/stdc++.h>
using namespace std;
int n, q, r, x[100010];
int d[17][100010];
int Pow2[20];
void PRE() {
  int k = 1;
  for (int i = 0; i < 20; i++) {
    Pow2[i] = k;
    k *= 2;
  }
  return;
}
int main() {
  PRE();
  cin >> n;
  for (int i = 0; i < n; i++) cin >> x[i];
  x[n] = 1145141919;
  cin >> r >> q;
  for (int i = 0; i < n; i++) {
    d[0][i] = upper_bound(x, x + n + 1, x[i] + r) - x;
    d[0][i]--;
  }
  d[0][n - 1] = n;
  for (int i = 1; i < 17; i++) {
    for (int j = 0; j < n; j++) {
      if (d[i - 1][j] < n)
        d[i][j] = d[i - 1][d[i - 1][j]];
      else
        d[i][j] = 114514;
    }
  }
  for (int i = 0; i < q; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    if (a > b) swap(a, b);
    int ans = 0;
    while (true) {
      if (a == b) break;
      int h, w;
      for (int j = 0; j < 17; j++) {
        if (d[j][a] <= b) h = d[j][a], w = Pow2[j];
      }
      ans += w;
      a = h;
    }
    cout << ans << endl;
  }
  return 0;
}
