#include <bits/stdc++.h>
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, -1, 0, 1};
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  if (N > 10000) return 0;
  vector<int> X(N);
  for (int i = 0; i < N; i++) cin >> X[i];
  int L;
  cin >> L;
  int Q;
  cin >> Q;
  if (Q > 10000) return 0;
  for (int i = 0; i < Q; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    int ans = 0;
    if (a < b) {
      int now = a;
      while (now != b) {
        int sum = 0;
        while (1) {
          if (now == b || sum + (X[now + 1] - X[now]) > L) {
            break;
          }
          sum += (X[now + 1] - X[now]);
          now++;
        }
        ans++;
      }
    } else {
      int now = a;
      while (now != b) {
        int sum = 0;
        while (1) {
          if (now == b || sum + (X[now] - X[now - 1]) > L) {
            break;
          }
          sum += (X[now] - X[now - 1]);
          now--;
        }
        ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
