#include <bits/stdc++.h>
using namespace std;
long long memo[1000 + 5][1000 + 5];
int main() {
  long long n, l, q, i, j, k, a, b, c, d;
  cin >> n;
  if (n > 1000) return 0;
  long long x[n];
  for (i = 0; i < n; i++) cin >> x[i];
  cin >> l >> q;
  memset(memo, -1, sizeof(memo));
  for (i = 0; i < q; i++) {
    cin >> a >> b;
    a--;
    b--;
    if (~memo[a][b]) {
      cout << memo[a][b] << endl;
      continue;
    }
    j = 0;
    k = 1;
    if (a > b) swap(a, b);
    for (c = a; c < b; c++) {
      d = x[c + 1] - x[c];
      if (j + d <= l)
        j += d;
      else {
        k++;
        j = d;
      }
    }
    memo[a][b] = k;
    cout << memo[a][b] << endl;
  }
  return 0;
}
