#include <bits/stdc++.h>
using namespace std;
int n, x[100006], d[100006][30], L, Q, l, r, m;
int find(int p) {
  int l = 0, r = n + 1;
  while (l < r) {
    int mid = (l + r + 1) / 2;
    if (x[mid] <= p)
      l = mid;
    else
      r = mid - 1;
  }
  return l;
}
int cont(int l, int r) {
  int re = 0;
  while (l != r) {
    int cnt = 0;
    while (d[l][cnt] < r) cnt++;
    if (d[l][cnt] != r) cnt--;
    re += 1 << cnt;
    l = d[l][cnt];
  }
  return re;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
  scanf("%d", &L);
  scanf("%d", &Q);
  for (int i = 1; i <= n; i++) d[i][0] = find(x[i] + L);
  for (int j = 1; (1 << j) * 2 <= n; j++)
    for (int i = 1; i <= n; i++) d[i][j] = d[d[i][j - 1]][j - 1];
  int ok = 0;
  printf("%d", 1 / ok);
  for (int i = 1; i <= Q; i++) {
    scanf("%d%d", &l, &r);
    if (l > r) swap(l, r);
    printf("%d\n", cont(l, r));
  }
}
