#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> x(n);
  for (int i = 0; i < n; ++i) {
    cin >> x[i];
  }
  int l;
  cin >> l;
  int q;
  cin >> q;
  assert(n <= 1000 && q <= 1000);
  for (int i = 0; i < q; ++i) {
    int a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    a--;
    b--;
    int ans = 1;
    while (a != b) {
      int sum = 0;
      while (a != b) {
        if (sum + x[a + 1] - x[a] > l) break;
        sum += x[a + 1] - x[a];
        a++;
      }
      if (a == b) break;
      ans++;
    }
    cout << ans << endl;
  }
}
