#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, ch = getchar(), f = 1;
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
const int N = 100005;
int n, xi[N], L, q, nxt[N][25];
int main() {
  n = read();
  for (int i = 1; i <= n; ++i) xi[i] = read();
  L = read(), q = read();
  int r = 1;
  for (int i = 1; i <= n; ++i) {
    while (r < n && xi[r + 1] - xi[i] <= L) ++r;
    nxt[i][0] = r;
  }
  for (int j = 1; (1 << j) <= n; ++j)
    for (int i = 1; i <= n; ++i) nxt[i][j] = nxt[nxt[i][j - 1]][j - 1];
  for (int i = 1; i <= q; ++i) {
    int x = read(), y = read();
    if (x > y) swap(x, y);
    long long ans = 0;
    for (int j = 19; j >= 0; --j)
      if (nxt[x][j] && nxt[x][j] < y) {
        x = nxt[x][j];
        ans += (1ll << j);
      }
    if (x == y)
      cout << ans << endl;
    else
      cout << ans + 1 << endl;
  }
  return 0;
}
