#include <bits/stdc++.h>
using namespace std;
const int DX[4] = {0, 1, 0, -1}, DY[4] = {-1, 0, 1, 0};
const int INF = 1e9;
const long long INFLL = 1e18;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++)
    os << *i << (i == end(v) - 1 ? "" : " ");
  return os;
}
int main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N, L, Q;
  cin >> N;
  vector<int> x(N);
  for (int i = 0; i < (int)(N); i++) cin >> x[i];
  cin >> L >> Q;
  for (int q = 0; q < (int)(Q); q++) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    if (a > b) swap(a, b);
    long long ans = 0, top = a;
    while (true) {
      ans++;
      long long t = (upper_bound(begin(x), end(x), x[top] + L) - begin(x)) - 1;
      if (t >= b) {
        cout << ans << endl;
        break;
      }
      top = t;
    }
  }
  return 0;
}
