#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9, MOD = 1e9 + 7,
          around[] = {0, 1, 1, -1, -1, 0, -1, 1, 0, 0};
const long long LINF = 1e18;
const long double PI = abs(acos(-1));
int main() {
  int n;
  cin >> n;
  int l, q, a[100010];
  for (int i = (0); i < (n); i++) cin >> a[i];
  cin >> l >> q;
  long long li[100010] = {};
  long long pos = 0, pot = 1;
  li[0] = 0;
  for (int i = (0); i < (n - 1); i++) {
    if (a[i + 1] - a[i] + pos <= l)
      li[i + 1] = pot, pos += a[i + 1] - a[i];
    else
      li[i + 1] = ++pot, pos = a[i + 1] - a[i];
  }
  for (int i = (0); i < (q); i++) {
    int x, y;
    cin >> x >> y;
    if (y < x) swap(x, y);
    x--;
    y--;
    cout << li[y] - li[x] + (li[y] == li[x]) << endl;
  }
  return 0;
}
