#include <bits/stdc++.h>
using namespace std;
const int N = 123456;
const int LOGN = 20;
int n, l, q;
int x[N];
int rg[N][LOGN];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", x + i);
  scanf("%d %d", &l, &q);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < LOGN; j++) rg[i][j] = n;
  int dist = 0;
  for (int i = 0, j = 0; i < n; i++) {
    while (j + 1 < n && dist <= l) {
      dist += x[j + 1] - x[j];
      j++;
    }
    if (dist > l) {
      j--;
      dist -= x[j + 1] - x[j];
    }
    rg[i][0] = j;
    dist -= x[i + 1] - x[i];
  }
  for (int j = 1; 1 << j <= n; j++)
    for (int i = 0; i <= n; i++) {
      rg[i][j] = rg[rg[i][j - 1]][j - 1];
    }
  int log;
  for (log = 1; 1 << log <= n; log++)
    ;
  log--;
  while (q--) {
    int a, b;
    scanf("%d %d", &a, &b);
    a--, b--;
    if (a > b) swap(a, b);
    int ans = 0;
    for (int i = log; i >= 0; i--) {
      if (rg[a][i] <= b) {
        a = rg[a][i];
        ans |= 1 << i;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
