#K446. Counting Elements Greater or Equal

    ID: 27567 Type: Default 1000ms 256MiB

Counting Elements Greater or Equal

Counting Elements Greater or Equal

You are given an array of n integers and m queries. For each query, determine how many numbers in the array are greater than or equal to the given query value.

More formally, for each query \(x\), compute the number of elements \(a_i\) such that \(a_i \ge x\). You may use the fact that after sorting the array, binary search can be applied to efficiently determine the count.

Input is read from standard input (stdin) and output is written to standard output (stdout).

inputFormat

The first line contains an integer n, the number of elements in the array.
The second line contains n space-separated integers representing the array.
The third line contains an integer m, the number of queries.
The fourth line contains m space-separated integers representing the queries.

outputFormat

Output m space-separated integers, where the \(i\)-th integer is the count of elements in the array that are greater than or equal to the \(i\)-th query. Output should be written in one line.

## sample
5
1 3 4 2 5
3
3 4 6
3 2 0