#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
int x[MAXN];
int L;
void gao(int l, int r, int& day, int& lValue, int& rValue, bool& tg) {
  if (l == r) {
    day = 1;
    lValue = 0;
    rValue = L;
    tg = true;
    return;
  }
  int mid = (l + r) >> 1;
  int day1, lValue1, rValue1, day2, lValue2, rValue2;
  bool tg1, tg2;
  gao(l, mid, day1, lValue1, rValue1, tg1);
  gao(mid + 1, r, day2, lValue2, rValue2, tg2);
  int dis = x[mid + 1] - x[mid];
  tg = false;
  day = day1 + day2;
  rValue = rValue2;
  lValue = lValue1;
  if (rValue1 >= dis) {
    if (rValue1 >= dis + lValue2) {
      if (tg2 == true) {
        tg = tg1 && tg2;
        rValue = rValue1 - lValue2 - dis;
        day = day1;
        if (tg1) {
          lValue = x[r] - x[l];
        }
      } else {
        day -= 1;
        if (tg1) {
          lValue += dis + lValue2;
        }
      }
    } else {
      if (tg1) {
        lValue += dis;
      }
    }
  } else {
    if (lValue2 + dis <= L) {
      if (tg2) {
        rValue -= dis;
      }
    } else {
      day += 1;
    }
  }
}
int work(int l, int r) {
  int day, lvalue, rvalue;
  bool tg;
  gao(l, r, day, lvalue, rvalue, tg);
  return day;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &x[i]);
  }
  scanf("%d", &L);
  int q;
  scanf("%d", &q);
  int start, end;
  while (q--) {
    scanf("%d%d", &start, &end);
    start--;
    end--;
    if (start > end) {
      swap(start, end);
    }
    printf("%d\n", work(start, end));
  }
}
