#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 100;
const int maxm = 1000 + 5;
long long X[maxn];
int q;
int n;
long long len;
const int STEP = 1000;
long long reach[maxn][maxm];
int cal(int L, int R) {
  int cur = L;
  int res = 0;
  while (cur < R) {
    if (reach[cur][STEP] < R) {
      res += STEP;
      cur = reach[cur][STEP];
    } else {
      int id =
          lower_bound(reach[cur] + 1, reach[cur] + STEP + 1, R) - reach[cur];
      res += id;
      cur = reach[cur][id];
    }
  }
  return res;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%lld", &X[i]);
  scanf("%lld", &len);
  int cur = 1;
  long long now = 0;
  while (cur + 1 <= n && now + X[cur + 1] - X[cur] <= len) {
    now += X[cur + 1] - X[cur];
    cur++;
  }
  reach[1][1] = cur;
  for (int i = 2; i <= n; ++i) {
    now -= X[i] - X[i - 1];
    while (cur + 1 <= n && now + X[cur + 1] - X[cur] <= len) {
      now += X[cur + 1] - X[cur];
      cur++;
    }
    reach[i][1] = cur;
  }
  for (int j = 2; j <= STEP; ++j) {
    for (int i = 1; i <= n; ++i) reach[i][j] = reach[reach[i][1]][j - 1];
  }
  scanf("%d", &q);
  while (q--) {
    int L, R;
    scanf("%d %d", &L, &R);
    if (L > R) swap(L, R);
    int res = cal(L, R);
    printf("%d\n", res);
  }
  return 0;
}
