#include <bits/stdc++.h>
using namespace std;
inline char nc() {
  return getchar();
  static char b[100000], *s = b, *t = b;
  return s == t && (t = (s = b) + fread(b, 1, 100000, stdin), s == t) ? -1
                                                                      : *s++;
}
inline void read(int &x) {
  char b = nc();
  x = 0;
  for (; !isdigit(b); b = nc())
    ;
  for (; isdigit(b); b = nc()) x = x * 10 + b - '0';
}
const int N = 100005;
int f[N][17], n, d, q, x[N];
int jump(int p, int d) {
  int *np = upper_bound(&f[p][0], &f[p][17], d) - 1;
  return np == &f[p][17] || *np > d ? p
                                    : jump(p + (1 << (np - &f[p][0])), d - *np);
}
inline int solve(int l, int r) {
  int res = 0;
  while (l < r) l = jump(l, d), ++res;
  return res;
}
int main() {
  read(n);
  for (int i = 1; i <= n; ++i) read(x[i]);
  for (int i = 1; i < n; ++i) f[i][0] = x[i + 1] - x[i];
  for (int j = 1; j < 17; ++j)
    for (int i = 1; i <= n; ++i)
      f[i][j] = f[i][j - 1] + f[i + (1 << (j - 1))][j - 1];
  read(d);
  read(q);
  for (int l, r; q--;) {
    read(l);
    read(r);
    if (l > r) swap(l, r);
    printf("%d\n", solve(l, r));
  }
  return 0;
}
