#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  int n, l, q;
  cin >> n;
  int x[n];
  for (int i = 0; i < n; i++) cin >> x[i];
  cin >> l >> q;
  int next[30][n];
  for (int i = 0, j = 0; i < n; i++) {
    while (j < n - 1 && x[j + 1] - x[i] <= l) j++;
    next[0][i] = j;
  }
  for (int k = 1; 1 << k <= l; k++)
    for (int i = 0; i < n; i++) next[k][i] = next[k - 1][next[k - 1][i]];
  int kmax = 29;
  while (1 << kmax > l) kmax--;
  while (q--) {
    int a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    int ans = 0, cur = a;
    for (int k = kmax; k >= 0 && cur < b; k--) {
      if (next[k][cur] <= b && (k == 0 || next[k - 1][cur] < b)) {
        ans += 1 << k;
        cur = next[k][cur];
      }
    }
    cout << ans << endl;
  }
}
