#include <bits/stdc++.h>
using namespace std;
int n, l, q, a, b, x[100000], jump[100000][17];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &x[i]);
  scanf("%d", &l);
  for (int i = n - 1, j = n - 1; i >= 0; i--) {
    while (x[j] - x[i] > l) j--;
    jump[i][0] = j;
    for (int k = 1; k <= 16; k++) {
      jump[i][k] = jump[jump[i][k - 1]][k - 1];
    }
  }
  scanf("%d", &q);
  while (q--) {
    scanf("%d %d", &a, &b);
  }
  return 0;
}
