#include <bits/stdc++.h>
using namespace std;
int n, l, q, a[100005], b[100005];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  scanf("%d", &l);
  int dem = 0, sum = 0;
  for (int i = 1; i < n; i++) {
    sum += a[i] - a[i - 1];
    while (sum > l) {
      b[dem] = i - 1;
      dem++;
      sum -= (a[dem] - a[dem - 1]);
    }
  }
  for (int i = dem; i < n; i++) {
    b[i] = n - 1;
  }
  scanf("%d", &q);
  while (q--) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--, v--;
    if (u > v) swap(u, v);
    int ans = 1;
    while (b[u] < v) {
      ans++;
      u = b[u];
    }
    printf("%d\n", ans);
  }
}
