#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int INF = 0x3f3f3f3f;
class range {
 public:
  class iterator {
    friend class range;

   public:
    int operator*() const { return i_; }
    iterator &operator++() {
      ++i_;
      return *this;
    }
    iterator operator++(int) {
      iterator copy(*this);
      ++i_;
      return copy;
    }
    bool operator==(const iterator &other) const { return i_ == other.i_; }
    bool operator!=(const iterator &other) const { return i_ != other.i_; }

   protected:
    iterator(int start) : i_(start) {}

   private:
    int i_;
  };
  iterator begin() const { return begin_; }
  iterator end() const { return end_; }
  range(int begin, int end) : begin_(begin), end_(end) {}

 private:
  iterator begin_;
  iterator end_;
};
template <typename T>
class reverse_iterator_class {
 public:
  explicit reverse_iterator_class(const T &t) : t(t) {}
  typename T::const_reverse_iterator begin() const { return t.rbegin(); }
  typename T::const_reverse_iterator end() const { return t.rend(); }

 private:
  const T &t;
};
using long long = long long;
template <typename T>
reverse_iterator_class<T> reverse(const T &t) {
  return reverse_iterator_class<T>(t);
}
using LL = long long;
const int inf = 0x3f3f3f3f;
const int maxn = 1e5 + 6;
int x[100000];
int r[17][100000];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  scanf("%d", &n);
  for (auto i : range(0, n)) {
    cin >> x[i];
  }
  int l, q;
  cin >> l >> q;
  for (auto i : range(0, n)) {
    r[0][i] = upper_bound(x, x + n, x[i] + l) - x - 1;
  }
  for (auto i : range(1, 17)) {
    for (auto j : range(0, n)) {
      r[i][j] = r[i - 1][r[i - 1][j]];
    }
  }
  for (auto i : range(0, q)) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    if (a > b) swap(a, b);
    int cnt = 0;
    for (int i = 16; i >= 0; i--) {
      if (r[i][a] < b) {
        a = r[i][a];
        cnt += 1 << i;
      }
    }
    cout << cnt + 1 << endl;
  }
}
