#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, L, x[N];
int jump[N][20];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < (int)(n); i++) cin >> x[i];
  cin >> L;
  int j = 0;
  for (int i = 0; i < (int)(n); i++) {
    while (j < n - 1 && x[j + 1] - x[i] <= L) j++;
    jump[i][0] = j;
  }
  for (int k = 0; k < 19; k++)
    for (int i = 0; i < (int)(n); i++) jump[i][k + 1] = jump[jump[i][k]][k];
  int q;
  cin >> q;
  while (q--) {
    int x, y;
    cin >> x >> y;
    --x;
    --y;
    if (x > y) swap(x, y);
    int ans = 0;
    for (int i = (int)(20) - 1; i >= ((int)0); i--)
      if (jump[x][i] <= y) {
        ans += 1 << i;
        x = jump[x][i];
      }
    cout << ans << '\n';
  }
  return 0;
}
