#include <bits/stdc++.h>
using namespace std;
int n;
int x[100003];
int l, q;
int a[100004], b[100004];
int nexPos(int pos, int b) {
  int c = pos + 1;
  while (x[c] - x[pos] <= l) {
    if (c == b) {
      return b;
    }
    c++;
  }
  return c - 1;
}
void day(int a, int b) {
  int ans = 1;
  int pos = a;
  while (nexPos(pos, b) != b) {
    ans++;
    pos = nexPos(pos, b);
  }
  cout << ans << endl;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x[i];
  }
  cin >> l >> q;
  while (q--) {
    int a, b;
    cin >> a >> b;
    if (a < b) {
      day(a, b);
    } else {
      day(b, a);
    }
  }
  return 0;
}
