#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int n, x[maxn], l, q, a, b, chafen[maxn][21];
int query(int s, int e) {
  if (s >= e) return 0;
  int ans = 0, L = l;
  for (int i = 20; i >= 0; i--)
    if (chafen[s][i] <= L) {
      int tt = i;
      ans++;
      L -= chafen[s][i];
      s += (1 << i);
    }
  return ans + query(s, e);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> x[i], chafen[i - 1][0] = x[i] - x[i - 1];
  for (int i = 1; i <= 20; i++)
    for (int j = 0; j + (1 << i) <= n; j++)
      chafen[j][i] = chafen[j][i - 1] + chafen[j + (1 << (i - 1))][i - 1];
  for (int i = 0; i <= 20; i++)
    for (int j = 0; j <= n; j++)
      if (chafen[j][i] == 0) chafen[j][i] = 1e9;
  cin >> l >> q;
  while (q--) {
    cin >> a >> b;
    if (a > b) swap(a, b);
    printf("%d\n", query(a, b));
  }
  return 0;
}
