#include <bits/stdc++.h>
using namespace std;
template <class T, size_t N>
ostream& operator<<(ostream& os, const array<T, N>& v);
template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  bool f = 1;
  os << "[";
  for (auto& i : v) {
    if (!f) os << ", ";
    os << i;
    f = 0;
  }
  return os << "]";
}
template <class T, size_t N>
ostream& operator<<(ostream& os, const array<T, N>& v) {
  bool f = 1;
  os << "[";
  for (auto& i : v) {
    if (!f) os << ", ";
    os << i;
    f = 0;
  }
  return os << "]";
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const set<T1, T2>& v) {
  bool f = 1;
  os << "[";
  for (auto& i : v) {
    if (!f) os << ", ";
    os << i;
    f = 0;
  }
  return os << "]";
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const multiset<T1, T2>& v) {
  bool f = 1;
  os << "[";
  for (auto& i : v) {
    if (!f) os << ", ";
    os << i;
    f = 0;
  }
  return os << "]";
}
template <class T1, class T2, class T3>
ostream& operator<<(ostream& os, const map<T1, T2, T3>& v) {
  bool f = 1;
  os << "[";
  for (auto& ii : v) {
    if (!f) os << ", ";
    os << "(" << ii.first << " -> " << ii.second << ") ";
    f = 0;
  }
  return os << "]";
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const multimap<T1, T2>& v) {
  bool f = 1;
  os << "[";
  for (auto& ii : v) {
    if (!f) os << ", ";
    os << "(" << ii.first << " -> " << ii.second << ") ";
    f = 0;
  }
  return os << "]";
}
template <class T1, class T2>
ostream& operator<<(ostream& os, priority_queue<T1, T2> v) {
  bool f = 1;
  os << "[";
  while (!v.empty()) {
    auto x = v.top();
    v.pop();
    if (!f) os << ", ";
    f = 0;
    os << x;
  }
  return os << "]";
}
template <class T1, class T2>
void printarray(const T1& a, T2 sz, T2 beg = 0) {
  for (T2 i = beg; i < sz; i++) cout << a[i] << " ";
  cout << endl;
}
const long long mod = 1e9 + 7;
long long N, Q, L;
long long x[100500];
long long nxt[20][100500];
int main() {
  scanf("%lld", &N);
  for (int i = 1; i <= N; i++) scanf("%lld", &x[i]);
  scanf("%lld%lld", &L, &Q);
  for (int i = 1; i <= N - 1; i++) {
    int low = i + 1, high = N, res = low;
    while (low <= high) {
      int mid = (low + high) / 2;
      if (x[mid] - x[i] <= L) {
        res = mid;
        low = mid + 1;
      } else
        high = mid - 1;
    }
    nxt[0][i] = res;
  }
  nxt[0][N] = N + 1;
  for (int k = 1; k < 20; k++) {
    for (int i = 1; i <= N; i++) {
      if (nxt[k - 1][i] == N + 1)
        nxt[k][i] = N + 1;
      else
        nxt[k][i] = nxt[k - 1][nxt[k - 1][i]];
    }
  }
  while (Q--) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (r < l) swap(l, r);
    int low = 0, high = N + 2, res = high;
    while (low <= high) {
      int mid = (low + high) / 2;
      int cur = l;
      for (int k = 0; k < 20; k++) {
        if (mid & (1 << k)) cur = nxt[k][cur];
      }
      if (cur >= r) {
        res = mid;
        high = mid - 1;
      } else
        low = mid + 1;
    }
    printf("%d\n", res);
  }
}
