Try our new interface for solving problems

Sort by growth

Sort by growth


At the opening ceremony of the Olympic Games, as well as at its closing ceremony, the athletes of each country wore the same costumes. Naturally, with so many athletes, coaches, and support staff, the process of sewing the Olympic parade uniform for many countries was quite responsible and important, and it was necessary to know the growth of each member of the delegation to sew the uniform in an appropriate size. The companies that will be engaged in tailoring this uniform are partly lucky, since it is known that none of the members of the delegation are shorter than one and a half meters and above two and a half meters.

You have a database with the growth of each member of the delegation for the respective kind of sport. Your task is to quickly answer the next type of query: how many members of the delegation have heights in the range from a to b centimeters inclusively?


The first line of each query contains one number n (1n20000) - the number of members in the corresponding delegation. The second line contains n integers - the heights of athletes in centimeters. The data are not sorted because they were placed in a database at the last moment, and therefore were not processed. The third line contains a query: two numbers - the lower and upper limits of growth, in which the manufacturer is interested.


For each query, print the answer on a separate line.

Time limit 3 seconds
Memory limit 128 MiB
Input example #1
153 168 155 167 155 167 155
165 170
189 191 169 190 192 191
165 172
Output example #1
Source II Открытая Дистанционная Олимпиада 2012-2013 им. В.Л.Дидковского