#include <bits/stdc++.h>
using namespace std;
int n;
int x[100000];
int l, q;
int a[100000];
int b[100000];
int s[100000];
int dbl[100000][18];
int rdbl[100000][18];
int main() {
  cin >> n;
  for (int i = 0; i < (n); ++i) {
    cin >> x[i];
  }
  cin >> l >> q;
  for (int i = 0; i < (q); ++i) {
    cin >> a[i] >> b[i];
    --a[i];
    --b[i];
  }
  for (int i = 0; i < (n - 1); ++i) {
    s[i + 1] = s[i] + (x[i + 1] - x[i]);
  }
  for (int i = 0; i < (n); ++i) {
    dbl[i][0] = upper_bound(s, s + n, s[i] + l + 1) - s - 1;
    rdbl[i][0] = lower_bound(s, s + n, s[i] - l) - s;
  }
  for (int j = 0; j < (17); ++j) {
    for (int i = 0; i < (n); ++i) {
      dbl[i][j + 1] = dbl[dbl[i][j]][j];
      rdbl[i][j + 1] = rdbl[rdbl[i][j]][j];
    }
  }
  for (int i = 0; i < (q); ++i) {
    if (a[i] < b[i]) {
      int s = 0;
      for (int j = 17; j >= 0; --j) {
        if (dbl[a[i]][j] < b[i]) {
          a[i] = dbl[a[i]][j];
          s += 1 << j;
        }
      }
      cout << s + 1 << endl;
    } else {
      int s = 0;
      for (int j = 17; j >= 0; --j) {
        if (rdbl[a[i]][j] > b[i]) {
          a[i] = rdbl[a[i]][j];
          s += 1 << j;
        }
      }
      cout << s + 1 << endl;
    }
  }
  return 0;
}
