using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int Inf = (int)1e9;
		for(int q=0;q<Q;q++){
			
			int[] min = new int[N];
			bool[] used = new bool[N];
			for(int j=0;j<N;j++)min[j] = Inf;
			int a = A[q]-1;
			int b = B[q]-1;
			min[a] = 0;
			used[a] = true;
			int t=1;
			while(!used[b]){
				for(int j=0;j<N;j++){
					if(!used[j])continue;
					for(t=1;j+t<N;j++){
						if(X[j+t] - X[j] >L)break;
						if(used[j+t])continue;
						min[j+t] = t;
						used[j+t] = true;
					}
					for(t=1;j-t>=0;j++){
						if(X[j] - X[j-t] >L)break;
						if(used[j+t])continue;
						min[j+t] = t;
						used[j+t] = true;
					}
				}
				t++;
			}
			Console.WriteLine(min[b]);
		}
		
	}
	int N;
	int[] X;
	int L;
	int Q;
	int[] A,B;
	public Sol(){
		N = ri();
		X = ria();
		L = ri();
		Q = ri();
		A = new int[Q];
		B = new int[Q];
		for(int i=0;i<N;i++){
			var d = ria();
			A[i] = d[0];
			B[i] = d[1];
		}
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}
