#include <bits/stdc++.h>
int n, L, q, l, r;
long long res, a[200005], f[200005][35];
using namespace std;
int read() {
  int ans = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    ans = ans * 10 + ch - '0';
    ch = getchar();
  }
  return ans * f;
}
int main() {
  n = read();
  for (int i = 0; i < n; i++) a[i] = read();
  L = read();
  q = read();
  for (int i = 0; i < n; i++) {
    int po = upper_bound(a, a + n, a[i] + L) - a;
    if (po == n)
      f[i + 1][0] = n;
    else
      f[i + 1][0] = po;
  }
  for (int j = 1; j <= 30; j++)
    for (int i = 1; i <= n; i++) f[i][j] = f[f[i][j - 1]][j - 1];
  while (q--) {
    res = 0;
    l = read();
    r = read();
    if (l > r) swap(l, r);
    for (int i = 30; i >= 0; i--) {
      if (f[l][i] < r) {
        res += (long long)(1 << i);
        l = f[l][i];
      }
    }
    cout << res + 1 << endl;
  }
  return 0;
}
