#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-9;
const long long INF = 10e17;
double equal(double a, double b) { return fabs(a - b) < DBL_EPSILON; }
std::istream &operator>>(std::istream &in, set<int> &o) {
  int a;
  in >> a;
  o.insert(a);
  return in;
}
std::istream &operator>>(std::istream &in, queue<int> &o) {
  long long a;
  in >> a;
  o.push(a);
  return in;
}
bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }
int solve(vector<long long> &hotels, long long l) {
  int a, b;
  cin >> a >> b;
  a--;
  b--;
  if (!(a < b)) swap(a, b);
  vector<vector<long long>> dp(b - a + 1, vector<long long>(b - a + 1, -1));
  dp[0][0] = 0;
  auto set = [&](int i, int j, long long v) {
    if (v > l) return;
    if (dp[i][j] == -1)
      dp[i][j] = v;
    else {
      dp[i][j] = min(dp[i][j], v);
    }
  };
  for (int i = 0; i < (b - a); ++i) {
    long long dis = hotels[a + i + 1] - hotels[a + i];
    for (int j = 0; j < (b - a); ++j) {
      if (dp[i][j] == -1) continue;
      set(i + 1, j + 1, dis);
      set(i + 1, j, dp[i][j] + dis);
    }
  }
  for (int i = 0; i < (b - a + 1); ++i) {
    if (dp.back()[i] != -1) {
      return i;
    }
  }
  __throw_runtime_error("nai");
}
int main() {
  int n;
  cin >> n;
  vector<long long> hotels(n);
  for (int i = 0; i < (n); ++i) cin >> hotels[i];
  long long l, q;
  cin >> l >> q;
  assert(n <= 10e2 && q <= 10e2);
  for (int _ = 0; _ < (q); ++_) {
    cout << solve(hotels, l) + 1 << endl;
  }
}
