#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
int N;
int hotel[100001];
int L, Q;
pair<int, int> r[100001];
void solve() {
  for (int i = 1; i <= Q; i++) {
    int cur_hi = r[i].first;
    int count = 1;
    while (1) {
      int tmp = 1;
      if (hotel[cur_hi + tmp] > hotel[cur_hi] + L) {
        cur_hi = cur_hi + tmp - 1;
        if (cur_hi == r[i].second) {
          printf("%d\n", count);
          break;
        }
        tmp = 1;
        count++;
      }
    }
  }
}
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &hotel[i]);
  }
  scanf("%d", &L);
  scanf("%d", &Q);
  for (int i = 1; i <= Q; i++) {
    int tmp1, tmp2;
    scanf("%d%d", &tmp1, &tmp2);
    r[i] = make_pair(tmp1, tmp2);
  }
  solve();
  return 0;
}
