#include <bits/stdc++.h>
using namespace std;
int n, step, k;
int x[100002];
int dp[100002][18];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> x[i];
  cin >> step >> k;
  for (int i = 1; i <= n; i++) {
    int l = i, r = n;
    while (l < r) {
      int mid = (l + r + 1) / 2;
      if (x[mid] - x[i] > step)
        r = mid - 1;
      else
        l = mid;
    }
    dp[i][0] = l;
  }
  for (int bit = 1; bit < 16; bit++)
    for (int i = 1; i <= n; i++) dp[i][bit] = dp[dp[i][bit - 1]][bit - 1];
  while (k--) {
    int a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    int ans = 0;
    for (int bit = 15; bit >= 0 && a < b; bit--)
      if (dp[a][bit] <= b) {
        ans += (1 << bit);
        a = dp[a][bit];
      }
    if (a < b) ans++;
    cout << ans << "\n";
  }
  return 0;
}
