#include <bits/stdc++.h>
using namespace std;
long long int n;
long long int x[100100];
long long int l;
long long int next_[22][100100];
inline long long int calc_next_(long long int pos) {
  long long int* new_pos = upper_bound(x, x + n, x[pos] + l);
  return (long long int)(new_pos - 1 - x);
}
inline long long int solve(long long int a, long long int b) {
  if (a > b) swap(a, b);
  long long int pos = a;
  long long int res = 0;
  while (pos != b) {
    res++;
    if (x[b] - x[pos] <= l) {
      pos = b;
      continue;
    }
    pos = calc_next_(pos);
  }
  return res;
}
inline long long int solve2(long long int a, long long int b) {
  if (a > b) swap(a, b);
  long long int step_width = 20;
  long long int res = 0;
  while (step_width >= 0) {
    if (next_[step_width][a] > b) {
    } else if (next_[step_width][a] == b) {
      res += (1ll << (long long int)(step_width));
      return res;
    } else {
      a = next_[step_width][a];
      res += (1ll << (long long int)(step_width));
    }
    step_width--;
  }
  return res;
}
int main() {
  cin >> n;
  for (long long int i = 0; i < ((long long int)(n)); i++) {
    cin >> x[i];
  }
  long long int q;
  cin >> l >> q;
  for (long long int i = 0; i < ((long long int)(n)); i++) {
    next_[0][i] = calc_next_(i);
  }
  next_[0][n - 1] = n;
  for (long long int i = (long long int)(1); i < ((long long int)(21)); i++) {
    for (long long int j = 0; j < ((long long int)(n)); j++) {
      long long int mid = next_[i - 1][j];
      if (mid >= n - 1) {
        next_[i][j] = n;
      } else {
        next_[i][j] = next_[i - 1][mid];
      }
    }
  }
  for (long long int i = 0; i < ((long long int)(q)); i++) {
    long long int a, b;
    cin >> a >> b;
    a--;
    b--;
    cout << solve2(a, b) << endl;
  }
  return 0;
}
