package main

import (
  "bufio"
  "fmt"
  "os"
  "sort"
  "strconv"
  "strings"
)

func main() {
  input := Input{bufio.NewReaderSize(os.Stdin,1000000)}
  n := input.NextInt()
  x := append(append([]int{0},input.NextIntArray()...),2100000000)
  l := input.NextInt()
  q := input.NextInt()
  for k:=0;k<q;k++ {
    a,b := input.NextInts()
    if a > b { a,b = b,a }
    m,y := 0,x[a]
    for y < x[b] {
      i := sort.Search(n,func(i int) bool { return y+l < x[i] })
      y = x[i-1]
      m++
    }
    fmt.Println(m)
  }
}

type Input struct { reader *bufio.Reader }
func(i *Input) NextLine() string {
  var buffer []byte
  for {
    line,isPrefix,err := i.reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func(i *Input) NextInt() int {
  n,_ := strconv.Atoi(i.NextLine())
  return n
}
func(i *Input) NextInts() (int,int) {
  s := strings.Split(i.NextLine()," ")
  x,_ := strconv.Atoi(s[0])
  y,_ := strconv.Atoi(s[1])
  return x,y
}
func(i *Input) NextIntArray() []int {
  s := strings.Split(i.NextLine()," ")
  a := make([]int,len(s))
  for i:=0;i<len(s);i++ { a[i],_ = strconv.Atoi(s[i]) }
  return a
}