#include <bits/stdc++.h>
int dp[20][100005];
int x[100005];
int main() {
  int N;
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) scanf("%d", &x[i]);
  int L, Q;
  scanf("%d%d", &L, &Q);
  int ptr = 1;
  for (int i = 1; i <= N; i++) {
    while (x[i] - x[ptr] > L) ptr++;
    dp[0][i] = ptr;
  }
  for (int i = 1; i < 20; i++) {
    for (int j = 1; j <= N; j++) {
      dp[i][j] = dp[i - 1][dp[i - 1][j]];
    }
  }
  for (int query = 0; query < Q; query++) {
    int a, b;
    scanf("%d%d", &a, &b);
    if (b < a) {
      int temp = b;
      b = a;
      a = temp;
    }
    int res = 0;
    while (b > a) {
      if (dp[0][b] <= a) {
        res += 1;
        break;
      }
      for (int i = 0; i < 19; i++) {
        if (dp[i + 1][b] < a || dp[i][b] == a) {
          b = dp[i][b];
          res += (1 << i);
          break;
        }
      }
    }
    printf("%d\n", res);
  }
  return 0;
}
