#include <bits/stdc++.h>
int a[100005];
long long dp[100005][55];
using namespace std;
int n, L, q;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  scanf("%d%d", &L, &q);
  for (int i = 1; i <= n; i++) {
    int x = lower_bound(a + 1, a + n + 1, a[i] + L) - a - 1;
    if (a[i] + L >= a[n])
      dp[i][0] = n;
    else
      dp[i][0] = x;
  }
  for (int i = 1; i <= 30; i++)
    for (int j = 1; j <= n; j++) dp[j][i] = dp[dp[j][i - 1]][i - 1];
  while (q--) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (r < l) swap(r, l);
    long long ans = 0;
    for (int i = 30; i >= 0; i--) {
      if (dp[l][i] < r) {
        ans = ans + (1 << i);
        l = dp[l][i];
      }
    }
    printf("%lld\n", ans + 1);
  }
  return 0;
}
