#include <bits/stdc++.h>
using namespace std;
const int MAXN = int(1E5);
const int MAXL = int(1E9);
int x[MAXN + 5], nxt[MAXN + 5][20];
int N, L, Q;
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) scanf("%d", &x[i]);
  scanf("%d%d", &L, &Q);
  for (int i = N; i >= 1; i--) {
    nxt[i][0] = upper_bound(x + 1, x + N + 1, x[i] + L) - x - 1;
    for (int j = 1; j <= 19; j++) nxt[i][j] = nxt[nxt[i][j - 1]][j - 1];
  }
  for (int i = 1; i <= Q; i++) {
    int le, ri;
    scanf("%d%d", &le, &ri);
    if (le > ri) swap(le, ri);
    int ans = 0;
    for (int j = 19; j >= 0; j--) {
      if (nxt[le][j] <= ri) {
        ans = ans + (1 << j);
        le = nxt[le][j];
      }
    }
    if (le != ri && nxt[le][0] > ri) ans++;
    printf("%d\n", ans);
  }
}
