#include <bits/stdc++.h>
using namespace std;
int N, L, Q;
int x[100010];
int day[100010];
void search(int n, int dist, int dy) {
  if (n == N + 1) return;
  dist += x[n] - x[n - 1];
  if (dist > L) dy++, dist = x[n] - x[n - 1];
  day[n] = dy;
  search(n + 1, dist, dy);
}
int main() {
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> x[i];
  }
  cin >> L;
  search(2, 0, 1);
  cin >> Q;
  for (int i = 0; i < Q; i++) {
    int a, b;
    cin >> a >> b;
    cout << (day[a] == day[b] ? 1 : abs(day[b] - day[a])) << endl;
  }
  return 0;
}
