13072 - Gugulo   

Description

You are given N integers a1a2, ..., aN, may contains same integers.

You need to answer Q queries: output how many integers of a1a2, ..., aN is less than or equal to xi.

Note: Be careful of the efficiency of your strategy.

Input

The first line contains one integer N (1 ≤ N ≤ 105) – the number of integers you are given.

The second line contains N integers a1a2, ..., aN (-2 x 109 ≤ ai ≤ 2 x 109).

The third line contains one integer Q (1 ≤ Q ≤ 105) – the number of queries you need to answer.

Then Q lines follow. The i+3-th line contains one integer xi (-2 x 109 ≤ xi ≤ 2 x 109) – the i-th query.

It's guaranteed that:

  • For every i < N,  xi ≥ xi+1(i.e every xi must be less than or equal to the previous xi).
  • For the first five testcases: 1 ≤ N ≤ 1000

Output

For every query output how many integers of a1a2, ..., aN is less than or equal to xi.

Sample Input  Download

Sample Output  Download

Tags




Discuss