#include <bits/stdc++.h>
using namespace std;
const long long Maxn = 100005;
const long long inf = 0x3f3f3f3f3f3f3f3f;
long long n, a[Maxn], L, q;
long long nxt[Maxn], nxt2[Maxn][20];
void init() {
  for (long long l = 1, r = 1; l <= n && r <= n && a[r] - a[l] <= L; ++l) {
    while (r <= n && a[r] - a[l] <= L) r++;
    r--;
    nxt[l] = r;
  }
  nxt[n] = inf;
  for (long long i = 1; i <= n; ++i) nxt2[i][0] = nxt[i];
  for (long long i = 1; i <= 19; ++i) {
    for (long long j = 1; j <= n; ++j) {
      if (nxt2[j][i - 1] == inf)
        nxt2[j][i] = inf;
      else
        nxt2[j][i] = nxt2[nxt2[j][i - 1]][0];
    }
  }
}
signed main() {
  cin >> n;
  for (long long i = 1; i <= n; ++i) cin >> a[i];
  cin >> L >> q;
  init();
  while (q--) {
    long long x, y, ans;
    cin >> x >> y;
    if (x > y) swap(x, y);
    if (nxt[x] >= y)
      ans = 1;
    else
      for (long long i = 0; i <= 18; ++i)
        if (nxt2[x][i] < y && nxt2[x][i + 1] >= y) {
          ans = i + 2;
          break;
        }
    cout << ans << endl;
  }
  return 0;
}
