#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = (0); i < (n); i++) cin >> a[i];
  long long l, q;
  cin >> l >> q;
  vector<long long> x(q), y(q);
  for (long long i = (0); i < (q); i++) {
    cin >> x[i] >> y[i];
    x[i]--;
    y[i]--;
    if (x[i] > y[i]) swap(x[i], y[i]);
  }
  long long m = log2(n) + 1;
  vector<vector<long long>> tmp(n, vector<long long>(m, (1LL << 60)));
  for (long long i = (0); i < (m); i++) {
    long long pos = (1 << i);
    for (long long j = (0); j < (n); j++) {
      if (j + pos < n) tmp[j][i] = a[j + pos] - a[j];
    }
  }
  for (long long i = (0); i < (q); i++) {
    long long ans = 0, pos = x[i];
    while (pos < y[i]) {
      long long sum = 0;
      while (1) {
        long long id = 0;
        while (id < m && sum + tmp[pos][id] <= l) id++;
        if (id == 0) break;
        sum += tmp[pos][id - 1];
        pos += (1 << (id - 1));
      }
      ans++;
    }
    cout << ans << endl;
  }
  return 0;
}
