#include <bits/stdc++.h>
using namespace std;
const long long inf = 100000000000000;
struct edge {
  int to, cost;
};
struct pos {
  int to, cost, color;
};
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
int dp[60][100002] = {};
int rdp[60][100002] = {};
int d[100002] = {};
int pa[100002];
vector<int> G[100002];
vector<int> child[100002];
vector<int> ra[100002];
priority_queue<pair<int, pair<int, int>>, vector<pair<int, pair<int, int>>>,
               greater<pair<int, pair<int, int>>>>
    que2;
queue<pos> que;
vector<int> vec;
int main() {
  int n, q, l;
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    int x1;
    cin >> x1;
    vec.push_back(x1);
  }
  int a2[32] = {};
  a2[0] = 1;
  for (long long i = 0; i < 31; ++i) a2[i + 1] = 2 * a2[i];
  memset(dp, -1, sizeof(dp));
  memset(rdp, -1, sizeof(rdp));
  cin >> l >> q;
  for (long long i = 0; i < n; ++i) {
    auto it = upper_bound(vec.begin(), vec.end(), vec[i] + l);
    dp[0][i] = it - vec.begin() - 1;
  }
  for (int i = n - 1; i >= 0; --i) {
    auto it = lower_bound(vec.begin(), vec.end(), vec[i] - l);
    rdp[0][i] = it - vec.begin();
  }
  for (long long j = 0; j < 31; ++j) {
    for (long long i = 0; i < n; ++i) {
      dp[j + 1][i] = dp[j][dp[j][i]];
      rdp[j + 1][i] = rdp[j][rdp[j][i]];
    }
  }
  for (long long i = 0; i < q; ++i) {
    int a1, b1;
    cin >> a1 >> b1;
    a1--;
    b1--;
    int t = 0;
    if (a1 < b1) {
      for (int j = 31 - 1; j >= 0; --j) {
        if (dp[j][a1] < b1) {
          t += a2[j];
          a1 = dp[j][a1];
        }
      }
      if (a1 < b1) t++;
    } else {
      for (int j = 31 - 1; j >= 0; --j) {
        if (rdp[j][a1] > b1) {
          t += a2[j];
          a1 = dp[j][a1];
        }
      }
      if (a1 > b1) t++;
    }
    cout << t << endl;
  }
  return 0;
}
