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