#pragma GCC optimize("O3")

#include <iostream>
#include <cstdio>
#include <cstring>
#include <list>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <complex>

#define in(x) scanf("%d",&x)
#define ein(x) ~scanf("%d",&x)
#define inl(x) scanf("%lld",&x)
#define ins(x) scanf("%s",x)
#define inf(x) scanf("%lf",&x)
#define inc(x) scanf("%c",&x)
#define gc() getchar()
#define out(x) printf("%d\n",x)
#define outl(x) printf("%lld\n",x)
#define od(x, y) printf("%d %d\n",x,y)
#define ms(x) memset(x,0,sizeof(x))
#define msc(x, n) memset(x,n,sizeof(x))
#define cp(x) while(!x.empty())x.pop()
#define rep(i, a, b) for(int i=a;i<b;++i)
#define rvep(i, a, b) for(int i=a;i>=b;--i)
#define elif else if
#define el else
#define wl(x) while(x)
#define sn scanf
#define bl bool
#define mp make_pair
#define pii pair<int,int>
#define rtn return
#define ope operator
#define cst const
#define it int
#define cr char
#define ctn continue
#define stt struct
#define il inline
#define tpl template
#define cl class
#define db double
#define sf(x) sizeof(x)
#define vt void
#define pf printf
typedef long long ll;
using namespace std;
cst it 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 ll = 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;
array<int, maxn> x;
array<array<int, maxn>, 20> r;

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.begin(), x.begin() + n, x[i] + l) - x.begin() - 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;
    }
}