#include <bits/stdc++.h>
using namespace std;
int n, l, q, x[110001], go[110001][19];
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++)
    go[i][0] = upper_bound(x + 1, x + n + 1, x[i] + l) - x - 1;
  for (int i = 1; i < 19; i++)
    for (int j = 1; j <= n; j++) go[j][i] = go[go[j][i - 1]][i - 1];
  while (q--) {
    int a, b, k = 18, ans = 0;
    scanf("%d%d", &a, &b);
    if (a > b) swap(a, b);
    while (a != b) {
      while (k && go[a][k] >= b) k--;
      a = go[a][k];
      ans += 1 << k;
    }
    printf("%d\n", ans);
  }
}
