#include <bits/stdc++.h>
using namespace std;
long long s[100010];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, l, t, a, b;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> s[i];
  }
  cin >> l;
  cin >> t;
  while (t--) {
    long long cnt = 0;
    cin >> a >> b;
    if (a < b) {
      long long k = 0;
      for (long long i = a + 1; i <= b; i++) {
        k = k + s[i] - s[i - 1];
        if (k > l) {
          i = i - 1;
          cnt++;
          k = 0;
        }
      }
      cnt++;
    } else if (a > b) {
      long long k = 0;
      for (long long i = a - 1; i >= b; i--) {
        k = k + s[i + 1] - s[i];
        if (k > l) {
          i = i + 1;
          cnt++;
          k = 0;
        }
      }
      cnt++;
    } else if (a == b) {
      cnt = 1;
    }
    cout << cnt << endl;
  }
}
