#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x[100001], l, q, next[100000][20];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> x[i];
  x[n] = 2e+9;
  cin >> l >> q;
  for (int i = 0; i < n; i++) {
    next[i][0] = upper_bound(x, x + n + 1, x[i] + l) - x - 1;
  }
  for (int i = 1; i < 20; i++) {
    for (int j = 0; j < n; j++) {
      next[j][i] = next[next[j][i - 1]][i - 1];
    }
  }
  for (int i = 0; i < q; i++) {
    int a, b, res = 0;
    cin >> a >> b;
    a--;
    b--;
    if (a > b) {
      int t = a;
      a = b;
      b = t;
    }
    while (1) {
      int j;
      for (j = 0; j < 20; j++) {
        if (next[a][j] >= b) break;
      }
      if (j != 20) {
        res += 1 << j;
        break;
      }
      res += 1 << 20;
    }
    cout << res << endl;
  }
  return 0;
}
