#include <bits/stdc++.h>
using namespace std;
long long int n, x[100000], l, q, a[100000], b[100000];
long long int lca[20][100000];
long long int aaa, bbb;
int main() {
  cin >> n;
  for (long long int i = 0; i < n; i++) {
    cin >> x[i];
  }
  cin >> l >> q;
  for (long long int i = 0; i < q; i++) {
    cin >> aaa >> bbb;
    a[i] = min(aaa - 1, bbb - 1);
    b[i] = max(aaa - 1, bbb - 1);
  }
  for (long long int i = 0; i < 20; i++) {
    for (long long int j = 0; j < 100000; j++) lca[i][j] = -1;
  }
  for (long long int i = 0; i < n - 1; i++) {
    if (x[i] + l >= x[n - 1]) {
      lca[0][i] = n - 1;
      continue;
    }
    long long int j = i;
    while (x[i] + l >= x[j + 1]) j++;
    lca[0][i] = j;
  }
  for (long long int i = 1; i < 20; i++) {
    for (long long int j = 0; j < n - 1; j++) {
      if (lca[i - 1][j] != -1) lca[i][j] = lca[i - 1][lca[i - 1][j]];
    }
  }
  long long int now, ans = 0;
  for (long long int i = 0; i < q; i++) {
    ans = 0;
    now = a[i];
    for (long long int soe = 19; soe >= 0; soe--) {
      if (lca[soe][now] != -1 && lca[soe][now] <= b[i]) {
        now = lca[soe][now];
        ans += (1 << soe);
      }
    }
    cout << ans << endl;
  }
}
