You are given a sorted with distinct positive integers. Harry has been looking for some integers that may or may not be in the array, and asks you questions about the index of these number.
Please write a program to help out Harry answer his questions.
Input Specifications
The first line will contain a single integer \(N\:(1\le N \le 10^5)\), representing the number of integers in the array.
The next line will contain distinct spaced positive integers, with the -th integer is \(m_i\:(1\le m_i \le 10^9)\).
The next line will contain a single integer \(Q\:(1\le Q \le 10^5)\), representing the questions.
The next lines will contain integer each, representing an integer Harry is looking for, where the -th integer is \(q_i\:(1\le q_i \le 10^9)\)
Output Specifications
For each of the questions, output the index of the number given. If the number is not within the array, then simply output -1
.
Sample Input
8
2 3 5 7 11 13 17 19
5
5
9
1
17
25
Sample Output
2
-1
-1
6
-1
Explanation for Sample Output
The integers 5 and 3 are within the array, and so their indices are outputted.
The integers 9, 1, and 25 are not within the array, and so -1
is outputted.
Comments