#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int n, x[maxn], l, q, a, b, chafen[maxn][21];
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
int query(int s, int e) {
  if (s >= e) return 0;
  int ans = 0, L = l;
  for (int i = 4; 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() {
  n = read();
  for (int i = 1; i <= n; i++)
    x[i] = read(), 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;
  l = read(), q = read();
  while (q--) {
    memset(chafen, 0, sizeof(chafen));
    memset(x, 0, sizeof(x));
    a = read(), b = read();
    if (a > b) swap(a, b);
    printf("%d\n", query(a, b));
  }
  return 0;
}
