#include <bits/stdc++.h>
using namespace std;
static const int NN = 1e5 + 5;
int N, L, Q;
vector<int> x(NN);
map<pair<int, int>, int> mp;
void solve(int a, int b) {
  if (mp[{a, b}] != 0) {
    cout << mp[{a, b}] << endl;
    return;
  }
  int ans = 1;
  int focus = a;
  int d = 0;
  while (focus < b) {
    if (d + x[focus + 1] - x[focus] <= L) {
      mp[{a, focus + 1}] = ans;
      d += x[focus + 1] - x[focus];
      focus++;
    } else {
      ans++;
      d = 0;
    }
  }
  cout << ans << endl;
}
int main() {
  cin >> N;
  for (int i = 1; i <= (int)N; i++) cin >> x[i];
  cin >> L >> Q;
  for (int i = 0; i < (int)Q; i++) {
    int a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    solve(a, b);
  }
  return 0;
}
