LearnPy Hub
← Arena
IntermediateRating 1200

Count Between

Answer q queries: how many array elements lie in [l, r]?

Input

n, the array, q, then q lines 'l r'.

Output

q lines.

Sample 1

Input
5
1 3 3 7 9
3
2 7
10 20
1 9
Output
3
0
5

Sample 2

Input
1
5
1
5 5
Output
1
solution.py
Output appears here
Count Between · Python Arena problem · LearnPy Hub