#include <bits/stdc++.h>
using namespace std;
int bk[17][100001];
int main() {
  int n, l, q;
  cin >> n;
  vector<int> x(n);
  for (int i = 0; i < n; ++i) scanf("%d", &x[i]);
  cin >> l >> q;
  int r = 0;
  for (int i = 0; i < n; ++i) {
    while (r < n - 1 && x[r + 1] - x[i] <= l) r++;
    bk[0][i] = r;
  }
  for (int i = 1; i <= 17; ++i) {
    for (int j = 0; j < n; ++j) {
      bk[i][j] = bk[i - 1][bk[i - 1][j]];
    }
  }
  while (q--) {
    int a, b;
    scanf("%d %d", &a, &b);
    a--;
    b--;
    if (a > b) swap(a, b);
    int ans = 0;
    for (int i = 16; i >= 0; --i) {
      if (bk[i][a] < b) {
        ans += 1 << i;
        a = bk[i][a];
      }
    }
    printf("%d\n", ans + 1);
  }
  return 0;
}
