#include <bits/stdc++.h>
using namespace std;
int to[25][100005];
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  long long int a[100005], len, q;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  cin >> len >> q;
  for (int i = 1; i <= n - 1; i++) {
    int lo = i + 1, hi = n, mid;
    while (lo < hi) {
      mid = (lo + hi) / 2;
      if (a[mid] - a[i] <= len)
        lo = mid + 1;
      else
        hi = mid;
    }
    if (a[lo] - a[i] > len) lo--;
    to[0][i] = lo;
  }
  to[0][n] = n;
  for (int i = 1; i <= 24; i++) {
    for (int j = 1; j <= n; j++) to[i][j] = to[i - 1][to[i - 1][j]];
  }
  while (q--) {
    int l, r;
    cin >> l >> r;
    if (l > r) swap(l, r);
    int ans = 0, ptr = l;
    for (int i = 24; i >= 0; i--) {
      if (to[i][ptr] <= r) {
        ans += (1 << i);
        ptr = to[i][ptr];
      }
    }
    if (ptr != r) ans++;
    cout << ans;
    cout << "\n";
  }
  return 0;
}
