Permutations (Easy)
Vasya has written all the numbers from 1 to n on a board in a specific order, using each number exactly once. Since the total number of numbers is quite large, Vasya can't easily view all of them at once. However, he wants to understand this sequence better, so he developed a program to answer a specific question: How many numbers, located between positions x and y on the board, fall within the range from k to l?
Your task is to replicate this functionality.
Input
The first line contains two natural numbers: n (1 ≤ n ≤ 100), which is the total number of numbers Vasya wrote, and m (1 ≤ m ≤ 100), which is the number of queries Vasya wants to make. The second line lists n integers, representing the sequence of numbers Vasya wrote. Following this, there are m lines, each describing a query with four integers: x, y (1 ≤ x ≤ y ≤ n) and k, l (1 ≤ k ≤ l ≤ n).
Output
For each of Vasya's queries, output a single line containing one number, which is the answer to the query.