#include <bits/stdc++.h>
using namespace std;
template <typename P, typename Q>
ostream& operator<<(ostream& os, pair<P, Q> p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
int main(int argc, char* argv[]) {
  int n;
  while (cin >> n) {
    int x[n];
    for (int i = 0; i < n; ++i) {
      cin >> x[i];
    }
    int l, q;
    cin >> l >> q;
    vector<pair<int, int>> v;
    for (int i = 0; i < q; ++i) {
      int a, b;
      cin >> a >> b;
      if (!(a < b)) swap(a, b);
      v.push_back(make_pair(a - 1, b - 1));
    }
    assert(n <= 1000 && q <= 1000);
    const int N = 1000 + 10;
    for (auto& q : v) {
      int curr = q.first;
      int step = 0;
      while (curr != q.second) {
        long long int sum = 0;
        while (curr != q.second) {
          sum += x[curr + 1] - x[curr];
          if (l < sum) break;
          ++curr;
        }
        ++step;
      }
      cout << step << endl;
    }
  }
  return 0;
}
