#include <bits/stdc++.h>
using namespace std;
double SCALE = 1.0;
double OFFSET_X = 0.0;
double OFFSET_Y = 0.0;
const int IINF = 1 << 28;
const int MOD = 1e9 + 7;
const double INF = 1e30;
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int main() {
  int N;
  long long x[100000], y[100000], L;
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> x[i];
  cin >> L;
  for (int i = 1; i < N; ++i) {
    y[i] = x[i] - x[i - 1];
  }
  if (N > 10000) return 0;
  int Q;
  cin >> Q;
  for (int i = 0; i < Q; ++i) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    if (a > b) swap(a, b);
    long long ans = 1;
    long long dist = 0;
    for (int j = a + 1; j < b + 1; ++j) {
      if (dist + y[j] <= L) {
        dist += y[j];
      } else {
        ++ans;
        dist = y[j];
      }
    }
    cout << ans << endl;
  }
}
