#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, mp[100000];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> mp[i];
  int l, q;
  cin >> l >> q;
  while (q--) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    if (a > b) swap(a, b);
    long long ans = 1, sum = 0;
    while (a != b) {
      if (sum + mp[a + 1] - mp[a] > l)
        ans++, sum = 0;
      else
        sum += mp[a + 1] - mp[a], a++;
    }
    cout << ans << endl;
  }
  return 0;
}
