3478. bsearch

Easy一维数组二分查找

时间限制:1000 ms

内存限制:256 MiB

题面

Binary search the sorted array with bsearch. If not found, output 1-1.

输入格式

The first line contains one integer nn (1n1051 \le n \le 10^5).

The second line contains nn space-separated integers a1,a2,,ana_1, a_2, \ldots, a_n. It is guaranteed that ai<ai+1a_i < a_{i+1} for 1i<n1 \le i < n. All numbers are distinct.

The third line contains one integer qq (1q1051 \le q \le 10^5).

The next qq lines each contains one integer kk, the number that is wanted.

All integers have absolute values no more than 10910^9.

输出格式

For each query, report the index ii (starting from 1) where ai=ka_i = k. If not found, output 1-1.

样例

输入

5
1 3 5 7 9
4
3
5
7
6

输出

2
3
4
-1