#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long INF = 1LL << 60;
const long long mod = 1e9 + 7;
const long double eps = 1e-8;
const long double pi = acos(-1.0);
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
void solve() {
  int n;
  cin >> n;
  vector<int> x(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  int l, q;
  cin >> l >> q;
  int r[20][100100], b[30][100100];
  int j = 0;
  for (int i = 0; i < n; i++) {
    while (j < n && x[j] - x[i] <= l) j++;
    r[0][i] = j - 1;
  }
  j = n - 1;
  for (int i = n - 1; i >= 0; i--) {
    while (j > -1 && x[i] - x[j] <= l) j--;
    b[0][i] = j + 1;
  }
  for (int k = 0; k + 1 < 20; ++k) {
    for (int i = 0; i < n; i++) {
      r[k + 1][i] = r[k][r[k][i]];
      b[k + 1][i] = b[k][b[k][i]];
    }
  }
  while (q--) {
    int x, y;
    cin >> x >> y;
    --x;
    --y;
    int res = 0;
    if (x < y) {
      for (int k = 19; k >= 0; --k) {
        if (r[k][x] <= y) {
          res += (1 << k);
          x = r[k][x];
        }
      }
    } else {
      for (int k = 19; k >= 0; --k) {
        if (b[k][x] >= y) {
          res += (1 << k);
          x = b[k][x];
        }
      }
    }
    cout << res << endl;
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
