arrayfind

Problem Description

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.

Input

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.

Output

For each query, output how many numbers is smaller than it and how many numbers are greater than it (See Below).

Sample Input

10
5 8 7 2 4 3 7 9 1 9
5
7
0
100
3
6

Sample Output

Smaller: 5, Greater: 3
Smaller: 0, Greater: 10
Smaller: 10, Greater: 0
Smaller: 2, Greater: 7
Smaller: 5, Greater: 5

Submitting .cpp to 'arrayfind'


You're not logged in! Click here to login


Compile Errors


							
Time Limit: 1 Seconds
Memory Limit: 1024MB
No. of ACs: 168
Your best score: 0
Source: Dunjudge Archive

Subtask Score
1 100
2 0