#include <bits/stdc++.h>
using namespace std;
const long long Mod = 1000000007;
struct P {
  long long pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {
  long long to, cost;
};
struct E {
  long long from, to, cost;
};
bool operator<(E a, E b) { return a.cost < b.cost; }
struct H {
  long long x, y;
};
bool operator<(H a, H b) {
  if (a.x != b.x) return a.x < b.x;
  return a.y < b.y;
}
bool operator>(H a, H b) {
  if (a.x != b.x) return a.x > b.x;
  return a.y > b.y;
}
bool operator==(H a, H b) { return a.x == b.x && a.y == b.y; }
bool operator!=(H a, H b) { return a.x != b.x || a.y != b.y; }
long long gcm(long long i, long long j) {
  if (i > j) swap(i, j);
  if (i == 0) return j;
  return gcm(j % i, i);
}
long double rad(H a, H b) {
  return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}
long long mod_pow(long long x, long long n, long long p) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % p;
    x = x * x % p;
    n >>= 1;
  }
  return res;
}
const long long Inf = 3023372036854775807;
const int inf = 1500000000;
long long n, l, q;
long long x[200000];
long long a[200000][25];
long long b[200000][25];
signed main() {
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> x[i];
  }
  cin >> l >> q;
  x[n] = x[n - 1] + l;
  long long r = 0, sum = 0;
  for (long long i = 0; i < n; i++) {
    while (r < n && sum + x[r + 1] - x[r] <= l) {
      sum += x[r + 1] - x[r];
      r++;
    }
    a[i][0] = r;
    sum -= x[i + 1] - x[i];
  }
  a[n][0] = n;
  r = n - 1, sum = 0;
  for (long long i = n - 1; i >= 0; i--) {
    while (r >= 0 && sum + x[r] - x[r - 1] <= l) {
      sum += x[r] - x[r - 1];
      r--;
    }
    if (r < 0) r = 0;
    b[i][0] = r;
    sum -= x[i] - x[i - 1];
  }
  for (long long i = 1; i < 25; i++) {
    for (long long j = 0; j < n; j++) {
      a[j][i] = a[a[j][i - 1]][i - 1];
      if (a[j][i - 1] == n) {
        a[j][i] = n;
      }
    }
    for (long long j = n - 1; j >= 0; j--) {
      if (b[j][i - 1] == 0) {
        b[j][i] = -1;
      } else {
        b[j][i] = b[b[j][i - 1]][i - 1];
      }
    }
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < 4; j++) {
      cout << b[i][j] << " ";
    }
    cout << endl;
  }
  for (long long i = 0; i < q; i++) {
    long long s, t;
    cin >> s >> t;
    s--;
    t--;
    long long ans = 0;
    while (s < t) {
      for (long long i = 24; i >= 0; i--) {
        if (a[s][i] <= t) {
          ans += 1 << i;
          s = a[s][i];
          break;
        }
      }
    }
    while (s > t) {
      for (long long i = 24; i >= 0; i--) {
        if (b[s][i] >= t) {
          ans += 1 << i;
          s = b[s][i];
          break;
        }
      }
      cout << s << endl;
      getchar();
      getchar();
    }
    cout << ans << endl;
  }
}
