class Main {
  import java.{ util => ju }

  import scala.annotation._
  import scala.collection._
  import scala.collection.{ mutable => mu }
  import scala.collection.JavaConverters._
  import scala.math._
  val sc = new ju.Scanner(System.in)

  def solveC() {
    val br = new java.io.BufferedReader(new java.io.InputStreamReader(System.in))
    val n = br.readLine().toInt
    val x = br.readLine().split(" ").map { _.toInt }
    val l = br.readLine().toInt
    val q = br.readLine().toInt

    val days = Array.ofDim[Int](n, n)
    for (i <- 0 until n - 1) {
      var result = 0
      for (j <- i + 1 until n) {
        val move = x(j) - x(j - 1)
        if (move <= result) {
          days(i)(j) = days(i)(j - 1)
          result -= move
        } else {
          result = l
          days(i)(j) = days(i)(j - 1) + 1
          result -= move
        }
      }
    }

    for (i <- 0 until q) {
      val fromTo = br.readLine().split(" ").map(_.toInt)
      val from = fromTo.min - 1
      val to = fromTo.max - 1
      println(days(from)(to))
    }

    br.close()
  }
  def solveA() {
    val n = sc.nextInt()
    val a = sc.nextInt()
    val nums = Array.fill[Int](n)(sc.nextInt())

    val first = nums.count(_ == a)
    if (n == 1) println(first)
    else {
      var second = 0
      for (i <- 0 until n - 1; j <- i + 1 until n) {
        if (nums(i) + nums(j) == a * 2) second += 1
      }
      var total = first + second
      for (i <- 2 until n) {

      }

      println(total)
    }

  }
}

object Main {
  def main(args: Array[String]): Unit = {
    val app = new Main()
    //    app.solveA()
    app.solveC()

  }
}
