#include <bits/stdc++.h>
using namespace std;
int l, n, q;
int x[100005];
int par[100005];
int pare[21][100005];
void initt() {
  memset(pare, -1, sizeof(pare));
  for (int i = 1; i <= n; i++) {
    pare[i][0] = par[i];
  }
  for (int j = 1; 1 << j < n; j++) {
    for (int i = 1; i <= n; i++) {
      if (pare[i][j - 1] != -1) pare[i][j] = pare[pare[i][j - 1]][j - 1];
    }
  }
}
signed main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x[i]);
  }
  x[n + 1] = INT_MAX;
  scanf("%d%d", &l, &q);
  int ri = 1;
  for (int i = 1; i <= n; i++) {
    while (x[ri] - x[i] <= l) ri++;
    ri--;
    par[i] = ri;
  }
  initt();
  int a, b;
  for (int i = 1; i <= q; i++) {
    scanf("%d%d", &a, &b);
    if (a == b) {
      cout << 0 << "\n";
      continue;
    }
    if (a > b) swap(a, b);
    int res = 0;
    for (int j = 20; j >= 0; j--) {
      if (pare[a][j] < b && pare[a][j] != -1) {
        a = pare[a][j];
        res += 1 << j;
      }
    }
    res += 1;
    printf("%d\n", res);
  }
}
