#include <bits/stdc++.h>
using namespace std;
int x[100000], y[100000];
int r[18][100000], c[18][100000];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
    scanf("%d", &x[i]), y[n - i - 1] = 0x3f3f3f3f - x[i];
  int l, q;
  scanf("%d%d", &l, &q);
  for (int i = 0; i < n; i++) {
    r[0][i] = upper_bound(x, x + n, x[i] + l) - x - 1;
    c[0][i] = upper_bound(y, y + n, y[i] + l) - y - 1;
  }
  for (int i = 1; i < 18; i++) {
    for (int j = 0; j < n; j++) {
      r[i][j] = r[i - 1][r[i - 1][j]];
      c[i][j] = c[i - 1][c[i - 1][j]];
    }
  }
  for (int i = 0; i < q; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    int lb = 0, rb = 0x3f3f3f3f;
    while (lb != rb) {
      int t = (lb + rb) / 2;
      int c = a, d = b;
      if (c > d) c = n - 1 - c, d = n - 1 - d;
      for (int i = 17; i >= 0; i--) {
        if (t >> i & 1) c = r[i][c];
      }
      if (c >= d)
        rb = t;
      else
        lb = t + 1;
    }
    printf("%d\n", lb);
  }
}
