#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int ans = 0;
  char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) ans = (ans << 3) + (ans << 1) + (ch ^ 48), ch = getchar();
  return ans;
}
int l, n, x[100005], q;
int main() {
  n = read();
  for (int i = 1; i <= n; ++i) x[i] = read();
  l = read(), q = read(), x[n + 1] = 2e9;
  while (q--) {
    int a = read(), b = read();
    if (a > b) a ^= b, b ^= a, a ^= b;
    int tmp = x[a] + l, cnt = 1, pos = lower_bound(x + a, x + b + 1, tmp) - x;
    if (tmp < x[pos]) --pos;
    while (pos < b) {
      ++cnt, tmp = x[pos] + l;
      pos = lower_bound(x + a, x + b + 1, tmp) - x;
      if (tmp < x[pos]) --pos;
    }
    printf("%d\n", cnt);
  }
  return 0;
}
