#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2> p) {
  o << "(" << p.first << ":" << p.second << ")";
  return o;
}
int n, length, query;
int data[100005];
int main() {
  int i, j, k, l;
  int a, b, p, d;
  cin >> n;
  for (i = 1; i <= n; i++) {
    scanf("%d", data + i);
  }
  cin >> length >> query;
  for (i = 0; i < query; i++) {
    scanf("%d%d", &a, &b);
    if (a > b) swap(a, b);
    for (d = 1, p = 0; a < b; a++) {
      p += data[a + 1] - data[a];
      if (length < p) {
        d++;
        p = data[a + 1] - data[a];
      }
    }
    cout << d << endl;
  }
  return 0;
}
