#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a < b) gcd(b, a);
  long long r;
  while ((r = a % b)) {
    a = b;
    b = r;
  }
  return b;
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
long long modinv(long long a, long long mod) {
  long long b = mod, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= mod;
  if (u < 0) u += mod;
  return u;
}
inline long long mod(long long a, long long m) { return (a % m + m) % m; }
long long extGcd(long long a, long long b, long long &p, long long &q) {
  if (b == 0) {
    p = 1;
    q = 0;
    return a;
  }
  long long d = extGcd(b, a % b, q, p);
  q -= a / b * p;
  return d;
}
pair<long long, long long> ChineseRem(long long b1, long long m1, long long b2,
                                      long long m2) {
  long long p, q;
  long long d = extGcd(m1, m2, p, q);
  if ((b2 - b1) % d != 0) return make_pair(0, -1);
  long long m = m1 * (m2 / d);
  long long tmp = (b2 - b1) / d * p % (m2 / d);
  long long r = mod(b1 + m1 * tmp, m);
  return make_pair(r, m);
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, l, q;
  cin >> n;
  int x[100005];
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  cin >> l >> q;
  int d[100004][30];
  for (int i = 0; i < n; i++) {
    if (l + x[i] >= x[n - 1]) {
      d[i][0] = n - 1;
    } else {
      d[i][0] = upper_bound(x, x + n, l + x[i]) - x - 1;
    }
  }
  for (int z = 1; z < 25; z++) {
    for (int i = 0; i < n; i++) {
      d[i][z] = d[d[i][z - 1]][z - 1];
    }
  }
  int a, b;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    a -= 1;
    b -= 1;
    if (a > b) {
      swap(a, b);
    }
    int ub = n - 1;
    int lb = 0;
    while (ub - lb > 1) {
      int mid = (ub + lb) / 2;
      int now = a;
      int mid2 = mid;
      while (mid2 > 0) {
        int tmp = 1;
        int cnt = 0;
        while (tmp <= mid2) {
          tmp *= 2;
          cnt += 1;
        }
        tmp /= 2;
        cnt -= 1;
        now = d[now][cnt];
        mid2 -= tmp;
      }
      if (now >= b)
        ub = mid;
      else
        lb = mid;
    }
    cout << ub << "\n";
  }
}
