#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chmax(T &a, T b) {
  a = max(a, b);
}
template <typename T>
void chmin(T &a, T b) {
  a = min(a, b);
}
template <typename T>
void chadd(T &a, T b) {
  a = a + b;
}
long long int dx[] = {0, 0, 1, -1};
long long int dy[] = {1, -1, 0, 0};
constexpr long long INF = 1001001001001001LL;
constexpr long long MOD = 1000000007LL;
long long int table[100010][18];
long long int N, L, Q;
long long int x[100010];
signed 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) < (N); (i)++) {
    long long int idx = upper_bound(x, x + N, x[i] + L) - x - 1;
    if (idx <= i)
      table[i][0] = -1;
    else
      table[i][0] = idx;
  }
  for (long long int(k) = (0); (k) < (17); (k)++) {
    for (long long int(i) = (0); (i) < (N); (i)++) {
      if (table[i][k] < 0)
        table[i][k + 1] = -1;
      else
        table[i][k + 1] = table[table[i][k]][k];
    }
  }
  for (long long int(i) = (0); (i) < (Q); (i)++) {
    long long int a, b;
    cin >> a >> b;
    a--;
    b--;
    if (a > b) swap(a, b);
    long long int cur = a, ans = 0;
    for (long long int(i) = (0); (i) < (20); (i)++) {
      for (long long int(k) = (17); (k) >= (0); (k)--) {
        long long int to = table[cur][k];
        if (to < 0 || to > b) continue;
        cur = to;
        ans += (1 << k);
        break;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
