#include <bits/stdc++.h>
using namespace std;
inline int read() {
  char c = getchar();
  int x = 0, f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
int n, a[100005], l, q, f[100005][33], ans;
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  l = read();
  q = read();
  for (int i = 1; i <= n; i++) {
    f[i][0] = upper_bound(a + 1, a + n + 1, a[i] + l) - a - 1;
  }
  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-- > 0) {
    int x = read(), y = read();
    int tmp = x;
    for (int i = 30; i >= 0; i--) {
      if (f[tmp][i] < y) {
        ans += (1 << i);
        tmp = f[tmp][i];
      }
    }
    cout << ans + 1 << "\n";
  }
}
