Submit solution
Points:
5
Time limit:
1.0s
Java
2.0s
Python
1.5s
Memory limit:
256M
Author:
Problem type
You have just uploaded your first video as a content creator.
Curious about which audiences you should be targeting, you have gathered data about different viewers. Specifically, you know the ages of every single person that has watched your video.
Given different queries, how many people between the ages of and inclusive have watched your video?
Input Specification
The first line of input contains an integer .
The second line of input contains space-separated integers .
The third line of input contains an integer .
The next lines of input each contain space-separated integers and .
Output Specification
For each query, output the total number of viewers between the ages of and inclusive.
Sample Input
8
12 8 7 12 14 15 9 28
5
6 12
3 5
13 18
3 20
28 28
Sample Output
5
0
2
7
1
Comments
1 billion years old and watching the same videos as a 1 year old...