#include <bits/stdc++.h>
using namespace std;
int read() {
  int f = 1, x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
  return x;
}
const int N = 100005;
int n, L, q;
int x[N], r[N][20], l[N][20];
int idx[N];
int main() {
  n = read();
  x[n + 1] = 1E9 + 7;
  x[0] = -1E9 - 7;
  for (int i = 2; i <= n; i++) idx[i] = idx[i >> 1] + 1;
  for (int i = 1; i <= n; i++) x[i] = read();
  L = read();
  q = read();
  int now = 1;
  for (int i = 1; i < n; i++) {
    while (x[now] - x[i] <= L && now <= n) now++;
    if (x[now] - x[i] > L) now--;
    r[i][0] = now;
  }
  r[n][0] = n + 1;
  now = n;
  for (int i = n; i >= 2; i--) {
    while (x[i] - x[now] <= L && now) now--;
    if (x[i] - x[now] > L) now++;
    l[i][0] = now;
  }
  l[1][0] = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= idx[(n - i) / L] + 1; j++) {
      r[i][j] = r[r[i][j - 1]][j - 1];
      l[i][j] = l[l[i][j - 1]][j - 1];
    }
  for (int i = 1; i <= q; i++) {
    int a = read(), b = read();
    if (a < b) {
      int ans = 0;
      while (a < b) {
        int ld = idx[(b - a) / L];
        ans += 1 << ld;
        a = r[a][ld];
      }
      printf("%d\n", ans);
    } else {
      int ans = 0;
      while (a > b) {
        int ld = idx[(a - b) / L];
        ans += 1 << ld;
        a = l[a][ld];
      }
      printf("%d\n", ans);
    }
  }
  return 0;
}
