N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i.

Tak the traveler has the following two personal principles:

* He never travels a distance of more than L in a single day.
* He never sleeps in the open. That is, he must stay at a hotel at the end of a day.



You are given Q queries. The j-th (1 \leq j \leq Q) query is described by two distinct integers a_j and b_j. For each query, find the minimum number of days that Tak needs to travel from the a_j-th hotel to the b_j-th hotel following his principles. It is guaranteed that he can always travel from the a_j-th hotel to the b_j-th hotel, in any given input.

Constraints

* 2 \leq N \leq 10^5
* 1 \leq L \leq 10^9
* 1 \leq Q \leq 10^5
* 1 \leq x_i < x_2 < ... < x_N \leq 10^9
* x_{i+1} - x_i \leq L
* 1 \leq a_j,b_j \leq N
* a_j \neq b_j
* N,\,L,\,Q,\,x_i,\,a_j,\,b_j are integers.

Input

The input is given from Standard Input in the following format:


N
x_1 x_2 ... x_N
L
Q
a_1 b_1
a_2 b_2
:
a_Q b_Q


Output

Print Q lines. The j-th line (1 \leq j \leq Q) should contain the minimum number of days that Tak needs to travel from the a_j-th hotel to the b_j-th hotel.

Example

Input

9
1 3 6 13 15 18 19 29 31
10
4
1 8
7 3
6 7
8 5


Output

4
2
1
2
// -*- coding: utf-8 -*-
//import java.awt.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;

public class Main {
  public static void main(String[] args) {
    InputStream inputStream;
    if (args.length > 0 && args[0].equals("devTesting")) {
      try {
        inputStream = new FileInputStream(args[1]);
      } catch(FileNotFoundException e) {
        throw new RuntimeException(e);
      }
    } else {
      inputStream = System.in;
    }
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    TaskE solver = new TaskE();
    solver.solve(1, in, out);
    out.close();
  }
  
  static class TaskE {    
    int n, l, q, xi, ai, bi;
    int[] hotelsPos;
    int[][] right, left;
    
    void solve(int testNumber, InputReader in, PrintWriter out) {
      n = in.nextInt();
      hotelsPos = new int[n];
      for (int i = 0; i < n; ++i) {
        hotelsPos[i] = in.nextInt();
      }
      l = in.nextInt();
      q = in.nextInt();
      pre();
      for (int i = 0; i < q; ++i) {
        ai = in.nextInt();
        bi = in.nextInt();
        --ai;
        --bi;
        out.println(query(ai, bi));
      }
    }
    
    void pre() {
      right = new int[17][n];
      left = new int[17][n];
      right[0][n - 1] = n;
      left[0][0] = -1;
      for (int i = 0; i < n - 1; ++i) {
        right[0][i] = Arrays.binarySearch(hotelsPos, hotelsPos[i] + l);
        if (right[0][i] < 0) {
          right[0][i] = ~right[0][i]; 
          --right[0][i];
        }
      }
      for (int i = 1; i < n; ++i) {
        left[0][i] = Arrays.binarySearch(hotelsPos, hotelsPos[i] - l);
        if (left[0][i] < 0) {
          left[0][i] = ~left[0][i]; 
        }
      }
      for (int i = 1; i < 17; ++i) { // f^(2^m)[i] = f^(2^(m - 1))[f^(2^(m - 1))[i]] -- O(n log(2^(max m))) = O(nm)
        for (int j = 0; j < n; ++j) {
          if (right[i - 1][j] < n) {
            right[i][j] = right[i - 1][right[i - 1][j]];
          } else {
            right[i][j] = n;
          }
          if (left[i - 1][j] > -1) {
            left[i][j] = left[i - 1][left[i - 1][j]];
          } else {
            left[i][j] = -1;
          }
        }
      }
    }
    
    int query(int a, int b) {
      int ans = 0;
      if (a < b) {
        for (int i = 16; i >= 0; --i) {
          if (right[i][a] < b) {
            a = right[i][a];
            ans += 1 << i;
          }
        }
      } else {
        for (int i = 16; i >= 0; --i) {
          if (left[i][a] > b) {
            a = left[i][a];
            ans += 1 << i;
          }
        }
      }
      ++ans;
      return ans;
    }
        
  }
      
  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream));
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }
    
    public String nextLine() {
      try {
        return reader.readLine();
      } catch(IOException e) {
        throw new RuntimeException(e);
      }
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public long nextLong() {
      return Long.parseLong(next());
    }
    
    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public boolean hasInput() {
      try {
        if (tokenizer != null && tokenizer.hasMoreTokens()) {
          return true;
        }
        reader.mark(1);
        int ch = reader.read();
        if (ch != -1) {
          reader.reset();
          return true;
        }
        return false;
      } catch(IOException e) {
        throw new RuntimeException(e);
      }
    }
    
  }
}
