#include <bits/stdc++.h>
using namespace std;
int n, L, Q, x[110000];
int a[110000][20];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= (n); ++i) scanf("%d", x + i);
  scanf("%d%d", &L, &Q);
  for (int i = 1; i <= (n); ++i)
    a[i][0] = upper_bound(x + i, x + n + 1, x[i] + L) - x - 1;
  for (int j = (1); j <= (17); ++j)
    for (int i = 1; i <= (n); ++i) a[i][j] = a[a[i][j - 1]][j - 1];
  int u, v, ans;
  while (Q--) {
    scanf("%d%d", &u, &v);
    if (u > v) swap(u, v);
    ans = 0;
    for (int j = (17); j >= (0); --j) {
      if (a[u][j] <= v) {
        u = a[u][j];
        ans += 1 << j;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
