#include <bits/stdc++.h>
using namespace std;
int n, l, q, x[100005], fr[100005][20], la;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
  scanf("%d%d", &l, &q);
  x[0] = x[1];
  la = 0;
  for (int i = 1; i <= n; i++) {
    while (x[la] + l < x[i]) la++;
    fr[i][0] = la;
  }
  for (int i = 2; i <= n; i++)
    for (int j = 1; (1 << j) <= i && j < 17; j++)
      fr[i][j] = fr[fr[i][j - 1]][j - 1];
  while (q--) {
    int a, b, ans = 0;
    scanf("%d%d", &a, &b);
    if (a > b) swap(a, b);
    int t;
    for (t = 0; (1 << t) <= x[b]; t++)
      ;
    t--;
    for (; t >= 0; t--)
      if (fr[b][t] >= a) b = fr[b][t], ans += (1 << t);
    if (b > a) ans++;
    printf("%d\n", ans);
  }
}
