#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const long long linf = (long long)1e18 + 7;
int n, l, q;
int x[100010];
int a, b;
void solve() {
  cin >> n;
  for (int i = (1); i <= (n); i++) cin >> x[i];
  cin >> l >> q;
  for (int i = (0); i <= (q - 1); i++) {
    cin >> a >> b;
    if (a > b) swap(a, b);
    int days = 0;
    while (a < b) {
      int j = a;
      while (j + 1 < n && x[j + 1] - x[a] <= l) j++;
      days++;
      a = j;
    }
    cout << days << '\n';
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  if (0) freopen(".in", "r", stdin);
  solve();
  return 0;
}
