#include <bits/stdc++.h>
using namespace std;
class Data {
 public:
  int Now;
  int l;
  Data(int nNow, int nDay) {
    Now = nNow;
    l = nDay;
  }
  bool operator<(Data &rdt) { return this->l < rdt.l; }
  bool operator>(Data &rdt) { return this->l > rdt.l; }
};
int n, l, q;
vector<int> a, b, x;
int solve(int a, int b) {
  int L = 0, day = 1;
  for (int i = 0; i < b - a; i++) {
    if (L - x[a - 1 + i] + x[a + i] > l) {
      L = -x[a - 1 + i] + x[a + i];
      day++;
    } else {
      L += -x[a - 1 + i] + x[a + i];
    }
  }
  return day;
}
int main() {
  cin >> n;
  x.resize(n);
  for (int i = 0; i < n; i++) cin >> x[i];
  cin >> l >> q;
  a.resize(q);
  b.resize(q);
  for (int i = 0; i < q; i++) {
    cin >> a[i] >> b[i];
  }
  for (int i = 0; i < q; i++) {
    if (a[i] > b[i])
      cout << solve(b[i], a[i]) << endl;
    else
      cout << solve(a[i], b[i]) << endl;
  }
  return 0;
}
