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

 class Program
    {
        static void Main(string[] args)
        {
            // get a inputs
            var hotelcount = int.Parse(Console.ReadLine());
            var hotels = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var lethargyLimit = int.Parse(Console.ReadLine());
            var queriescount = int.Parse(Console.ReadLine());
            var queries = new List<int[]>();
            while(queriescount > 0)
            {
                queriescount--;
                queries.Add(Console.ReadLine().Split(' ').Select(int.Parse).ToArray());
            }

            foreach(var query in queries)
                Console.WriteLine(FindDays(query[0] - 1, query[1] - 1, hotels, lethargyLimit));
        }

        public static int FindDays(int start, int end, int[] arr, int limit)
        {
            var dir = start < end ? 1 : -1;
            var days = 1;
            var walked = 0;
            while(start != end)
            {
                var next = start + dir;
                var dis = Math.Abs(arr[start] - arr[next]);
                if (dis + walked > limit)
                {
                    walked = dis;
                    days++;
                }
                else
                {
                    walked += dis;
                }
start = next;
            }
            return days;
        }
    }