#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007LL;
int n, l, q;
int x[100005];
int dp[100005][20];
long long sum[100005];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &x[i]);
  }
  memset(sum, 0, sizeof(sum));
  for (int i = 2; i <= n; ++i) {
    sum[i] = sum[i - 1] + x[i] - x[i - 1];
  }
  scanf("%d", &l);
  for (int i = 1; i <= n; ++i) {
    int y = i;
    int z = n;
    while (y < z) {
      int mid = (y + z + 1) / 2;
      if (sum[mid] - sum[i] > l) {
        z = mid - 1;
      } else {
        y = mid;
      }
    }
    dp[i][0] = y;
  }
  for (int j = 1; j <= 20; ++j) {
    for (int i = 1; i <= n; ++i) {
      dp[i][j] = dp[dp[i][j - 1]][j - 1];
    }
  }
  scanf("%d", &q);
  for (int i = 1; i <= q; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    if (a > b) swap(a, b);
    int res = 0;
    int cur = a;
    for (int j = 20; j >= 0; --j) {
      if (dp[cur][j] <= b) {
        res += 1 << j;
        cur = dp[cur][j];
      }
    }
    if (cur < b) res++;
    cout << res << endl;
  }
  return 0;
}
