#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int nxt[maxn][17], x[maxn];
int n, l, q;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (n); ++i) scanf("%d", x + i);
  scanf("%d", &l);
  for (int i = (1); i <= (n); ++i) {
    int it = upper_bound(x, x + n, x[i - 1] + l) - x;
    nxt[i][0] = it;
    if (x[i - 1] + l > x[n - 1]) nxt[i][0] = n + 1;
  }
  nxt[n + 1][0] = n + 1;
  for (int j = (1); j <= (17); ++j) {
    nxt[n + 1][j] = n + 1;
    for (int i = (1); i <= (n); ++i) {
      nxt[i][j] = nxt[nxt[i][j - 1]][j - 1];
    }
  }
  scanf("%d", &q);
  while (q--) {
    int a, b;
    scanf("%d %d", &a, &b);
    if (a > b) swap(a, b);
    int i = 16, ans = 0;
    while (i >= 0) {
      if (nxt[a][i] <= b) {
        a = nxt[a][i];
        ans += 1 << i;
      }
      if (a == b) break;
      --i;
    }
    printf("%d\n", max(ans, 1));
  }
  return 0;
}
