#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l, q, a, b;
  int x[100001];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> x[i];
  cin >> l >> q;
  if (100001 < n || 100001 < q) return 0;
  for (int i = 0; i < q; i++) {
    cin >> a >> b;
    a--;
    b--;
    int count = 0, ans = 1;
    for (int j = min(a, b); j < max(a, b); j++) {
      if (l <= (x[j + 1] - x[j]) + count) {
        count = 0;
        ans++;
      }
      count += (x[j + 1] - x[j]);
    }
    cout << ans << endl;
  }
  return 0;
}
