#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int x[n + 1], i;
  for (i = 1; i <= n; i++) scanf("%d", &x[i]);
  int l, q;
  scanf("%d %d", &l, &q);
  int spot[q][2];
  for (i = 0; i <= q - 1; i++) scanf("%d %d", &spot[i][0], &spot[i][1]);
  for (i = 0; i <= q - 1; i++) {
    int day = 0;
    int now = spot[i][0], goal = spot[i][1];
    if (now < goal) {
      while (now < goal) {
        int j = 1;
        while (x[now + j] <= x[now] + l) j++;
        now = now + j - 1;
        day++;
      }
    } else {
      while (now > goal) {
        int k = 1;
        while (x[now - k] >= x[now] - l) k++;
        now = now - k + 1;
        day++;
      }
    }
    printf("%d\n", day);
  }
  return 0;
}
