#include <bits/stdc++.h>
using namespace std;
int n, l, q, h[100010], dt[100010][20], a, b, now;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", h + i);
  h[n + 1] = 1000000010;
  scanf("%d%d", &l, &q);
  for (int i = 1; i <= n; i++)
    dt[i][0] = (int)(upper_bound(h + 1, h + n + 2, h[i] + l) - h) - 1;
  for (int j = 1; j < 20; j++)
    for (int i = 1; i <= n; i++) dt[i][j] = dt[dt[i][j - 1]][j - 1];
  while (q--) {
    scanf("%d%d", &a, &b);
    if (a > b) swap(a, b);
    int cnt = 0, d;
    while (a < b) {
      for (int i = 0;; i++)
        if (dt[a][i] > b) {
          cnt += (1 << (i - 1)), a = dt[a][i - 1];
          break;
        }
    }
    printf("%d\n", cnt);
  }
  return 0;
}
