#include <bits/stdc++.h>
using namespace std;
int n;
int a[100005];
int b[100005];
int s[100005][20];
int l;
int task;
int st, nt;
int getans(int x) {
  int i = 0;
  int ans = 1;
  for (i = 0; i < 20; i++) {
    ans *= 2;
    if (s[x][i] >= nt) break;
  }
  ans /= 2;
  if (s[x][i] == nt)
    return ans;
  else
    return ans / 2 + getans(s[x][i - 1]);
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i < n; i++) b[i] = a[i] - a[i - 1];
  cin >> l;
  int q = 0;
  int j = 1;
  for (int i = 0; i < n; i++) {
    q -= b[i];
    while (q + b[j] <= l && j < n) {
      q += b[j];
      j++;
    }
    s[i][0] = j - 1;
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 19; j++) s[i][j + 1] = s[s[i][j]][j];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 20; j++)
      if (s[i][j] == 0) s[i][j] = n - 1;
  cin >> task;
  for (int tt = 0; tt < task; tt++) {
    cin >> st >> nt;
    st--;
    nt--;
    if (st > nt) swap(st, nt);
    cout << getans(st) << endl;
  }
  return 0;
}
