#include <bits/stdc++.h>
using namespace std;
const int N = 2e5;
int dep[N], f[N][20], nxt[N], fst[N], to[N], n, L, q, x[N], mm;
void ade(int u, int v) { to[++mm] = v, nxt[mm] = fst[u], fst[u] = mm; }
void dfs(int u, int fa) {
  f[u][0] = fa;
  dep[u] = dep[fa] + 1;
  for (int i = 1; f[u][i - 1]; i++) f[u][i] = f[f[u][i - 1]][i - 1];
  for (int i = fst[u]; i; i = nxt[i]) {
    int v = to[i];
    if (v == fa) continue;
    dfs(v, u);
  }
}
int query(int u, int v) {
  int ans = 0;
  for (int i = 19; i >= 0; i--)
    if (dep[f[u][i]] >= dep[v]) u = f[u][i], ans += (1 << i);
  if (dep[u] > dep[v]) ++ans;
  return ans;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", x + i);
  scanf("%d%d", &L, &q);
  long long s = 0;
  for (int i = 1, j = 2; i < n; i++) {
    while (s + x[j] - x[j - 1] <= L && j <= n) s += x[j] - x[j - 1], ++j;
    ade(j - 1, i);
    s -= x[i + 1] - x[i];
  }
  dfs(n, 0);
  for (int i = 1; i <= q; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (l > r) swap(l, r);
    printf("%d\n", query(l, r));
  }
}
