#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int n, x[maxn], l, q, a, b, vis[maxn], nextnext[maxn][20];
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
int query(int s, int e) {
  int ans = 0;
  while (s < e) {
    for (int i = 19; i >= 0; i--) {
      if (nextnext[s][i] <= e && nextnext[s][i]) {
        s = nextnext[s][i];
        ans += (1 << i);
        break;
      }
      if (i == 0) {
        s = nextnext[s][i];
        ans += (1 << i);
        break;
      }
    }
    return ans;
  }
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) x[i] = read();
  l = read();
  for (int i = 1; i <= n; i++)
    nextnext[i][0] = upper_bound(x + 1 + 1, x + n + 1, x[i] + l) - x - 1;
  for (int i = 1; i <= 19; i++)
    for (int j = 1; (long long)l * (1 << i) + x[j] <= x[n]; j++)
      nextnext[j][i] = nextnext[nextnext[j][i - 1]][i - 1];
  q = read();
  while (q--) {
    a = read(), b = read();
    if (a > b) swap(a, b);
    printf("%d\n", query(a, b));
  }
  return 0;
}
