#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n, l, q;
int a[maxn];
long long b[maxn], c[maxn], d[maxn];
int main() {
  while (~scanf("%d", &n)) {
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    memset(c, 0, sizeof(c));
    memset(d, 0, sizeof(d));
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]), d[i] = a[i] - a[i - 1];
    for (int i = 1; i <= n; i++) b[i] = d[i] + b[i - 1];
    for (int i = n; i >= 1; i--) c[i] = d[i + 1] + c[i + 1];
    scanf("%d%d", &l, &q);
    int x, y, ans;
    for (int i = 1; i <= q; i++) {
      scanf("%d%d", &x, &y);
      ans = 0;
      if (x < y) {
        while (x < y) {
          int nx = 1;
          while (x + nx <= n && b[x + nx] - b[x] <= (long long)l) nx <<= 1;
          nx >>= 1;
          while (x + nx <= n && b[x + nx] - b[x] <= (long long)l) nx++;
          nx--;
          if (nx == 0) nx = 1;
          x += nx;
          ans++;
        }
      } else if (x > y) {
        while (x > y) {
          int nx = 1;
          while (x - nx >= 1 && c[x - nx] - c[x] <= (long long)l) nx <<= 1;
          nx >>= 1;
          while (x - nx >= 1 && c[x - nx] - c[x] <= (long long)l) nx++;
          nx--;
          if (nx == 0) nx = 1;
          x -= nx;
          ans++;
        }
      }
      printf("%d\n", ans);
    }
  }
  return 0;
}
