#include <bits/stdc++.h>
using namespace std;
int n, l, q, x[100005], fa[100005][18];
inline void pre() {
  for (int i = 1, j; i <= n; ++i) {
    for (j = i; j <= n && x[j] - x[i] <= l; ++j)
      ;
    fa[i][0] = j - 1;
  }
  for (int i = 1; i <= 17; ++i)
    for (int j = 1; j <= n; ++j) fa[j][i] = fa[fa[j][i - 1]][i - 1];
}
inline void solve(int a, int b) {
  if (a > b) swap(a, b);
  int ans = 0;
  for (int i = 17; i >= 0; --i)
    if (fa[a][i] < b) a = fa[a][i], ans += (1 << i);
  printf("%d\n", ++ans);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &x[i]);
  scanf("%d%d", &l, &q);
  pre();
  int a, b;
  for (int i = 1; i <= q; ++i) scanf("%d%d", &a, &b), solve(a, b);
  return 0;
}
