#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
const int iinf = INT_MAX / 2;
const long long linf = LLONG_MAX / 2;
const int MOD = 1e9 + 7;
inline int read() {
  int X = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  return w ? -X : X;
}
void write(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
void print(int x) {
  cout << x << '\n';
  exit(0);
}
void douout(double x) { printf("%lf\n", x + 0.0000000001); }
int n, l, q;
int a[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  scanf("%d%d", &l, &q);
  while (q--) {
    int x, y;
    scanf("%d%d", &x, &y);
    int ans = 0;
    if (x <= y) {
      int now = x;
      while (now < y) {
        int pos = now;
        while (a[pos] - a[now] <= l) pos++;
        pos--;
        now = pos;
        ans++;
      }
    } else {
      int now = x;
      while (now > y) {
        int pos = now;
        while (abs(a[pos] - a[now]) <= l) pos--;
        pos++;
        now = pos;
        ans++;
      }
    }
    cout << ans << '\n';
  }
}
