#include <bits/stdc++.h>
using namespace std;
int n;
long long a[110000];
long long l;
int m;
int f[110000];
inline void init() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  scanf("%lld", &l);
  scanf("%d", &m);
  f[1] = 0;
  f[2] = 1;
  long long total = f[2] - f[1];
  for (int i = 3; i <= n; i++) {
    if (total + a[i] - a[i - 1] <= l)
      f[i] = f[i - 1], total += a[i] - a[i - 1];
    else
      f[i] = f[i - 1] + 1, total = a[i] - a[i - 1];
  }
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x > y) swap(x, y);
    printf("%d\n", max(f[y] - f[x], 1));
  }
}
int main() {
  init();
  return 0;
}
