Permutations (Easy)#2315

Permutations (Easy)

1 second
64 megabytes
Very easy

Vasya has written all the numbers from to on a board in some order, using each number exactly once. Since the total number of numbers is quite large, Vasya cannot see all of them at once. Therefore, he wrote a program to answer the following question: how many numbers in positions from to (inclusive) are within the range from to by value?

Do the same.

Input

The first line contains two natural numbers: (1 \leq n \leq 100) — the number of numbers Vasya wrote, and (1 \leq m \leq 100) — the number of queries Vasya wants to ask.

The second line contains integers — the sequence of numbers Vasya wrote.

Each of the next lines describes a query with four integers: , (1 \leq x \leq y \leq n), and , (1 \leq k \leq l \leq n).

Output

Print lines. Each line should contain one number — the answer to the corresponding query.

Examples

Example 1

Loading
Loading