#include <bits/stdc++.h>
using namespace std;
int n, l, q, x[100011], m[100011][17];
long long d[100011];
long long go(int a, int b) {
  if (a > b) swap(a, b);
  int ans = 0;
  while (a < b) {
    int k = 0;
    for (k = 16; k > 0; k--)
      if (m[a][k] <= b) break;
    a = m[a][k];
    ans += 1 << k;
  }
  return ans;
}
inline int Next(int i) {
  int le = i + 1, ri = n, ret = i + (i < n);
  while (le <= ri) {
    int mid = (le + ri) >> 1;
    int d = x[mid] - x[i];
    if (d <= l)
      ret = mid, le = mid + 1;
    else
      ri = mid - 1;
  }
  return ret;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", x + i);
  scanf("%d%d", &l, &q);
  for (int i = 1; i <= n; i++) {
    m[i][0] = Next(i);
  }
  for (int j = 1; j < 17; j++) {
    for (int i = 1; i <= n; i++) m[i][j] = m[m[i][j - 1]][j - 1];
  }
  for (int i = 1; i <= q; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    printf("%lld\n", go(u, v));
  }
  return 0;
}
