#include <bits/stdc++.h>
using namespace std;
long long x[100000];
int idx[100000][40][2];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N, L, Q;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> x[i];
  }
  cin >> L >> Q;
  for (int i = 0; i < N; i++) {
    idx[i][0][0] = upper_bound(x, x + N, x[i] + L) - x - 1;
    idx[i][0][1] = lower_bound(x, x + N, x[i] - L) - x;
    for (int j = 1; j < 30; j++) {
      idx[i][j][0] = N - 1;
      idx[i][j][1] = 0;
    }
  }
  for (int j = 0; j < 30; j++) {
    for (int i = N - 1; i >= 0; i--) {
      idx[i][j + 1][0] = idx[idx[i][j][0]][j][0];
    }
    for (int i = 0; i < N; i++) {
      idx[i][j + 1][1] = idx[idx[i][j][1]][j][1];
    }
  }
  for (int i = 0; i < Q; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    long long pos = a;
    int cnt = 0;
    if (a < b) {
      while (pos != b) {
        for (int j = 30; j >= 0; j--) {
          int np = idx[pos][j][0];
          if (np <= b) {
            pos = np;
            cnt += 1 << j;
            break;
          }
          if (j == 0) {
            cnt++;
            pos = b;
            break;
          }
        }
      }
    } else {
      while (pos != b) {
        for (int j = 30; j >= 0; j--) {
          int np = idx[pos][j][1];
          if (np >= b) {
            pos = np;
            cnt += 1 << j;
            break;
          }
          if (j == 0) {
            cnt++;
            pos = b;
            break;
          }
        }
      }
    }
    cout << cnt << endl;
  }
}
