Rar the cat hates counting and wants you to help. This time, he has an array of numbers not more than 1000000 length long. He also has Q queries. Each query will consist of a number, x. You are supposed to tell him how many numbers in the array are above and below x.
The first line of input consists of L, the length of the array.
The second line of input consists of L integers, space separated. You may assume they all fit into a 32bit signed integer.
The third line of input consists of Q, the number of queries. Q will be not more than 10000.
The following Q line of input consists of one number each, x. You may assume they all fit into a 32bit signed integer.
For each query, output how many numbers is smaller than it and how many numbers are greater than it (See Below).
10 5 8 7 2 4 3 7 9 1 9 5 7 0 100 3 6
Smaller: 5, Greater: 3 Smaller: 0, Greater: 10 Smaller: 10, Greater: 0 Smaller: 2, Greater: 7 Smaller: 5, Greater: 5
Subtask | Score |
---|---|
1 | 100 |
2 | 0 |