#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9 + 7;
const int N = (int)1e5 + 7;
int n, L, q;
int a[N];
map<int, int> u[N];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  cin >> L >> q;
  while (q--) {
    int l, r;
    cin >> l >> r;
    if (l > r) swap(l, r);
    if (u[l][r]) {
      cout << u[l][r] << endl;
      continue;
    }
    long long cnt = 0, sum = 0;
    for (int i = l; i < r; i++) {
      if (sum + (a[i + 1] - a[i]) > L) sum = 0, cnt++;
      sum += (a[i + 1] - a[i]);
    }
    if (sum >= 0) cnt++;
    u[l][r] = cnt;
    cout << cnt << endl;
  }
}
