#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e6 + 10;
int a[N];
int n, x;
int main() {
// 读取数组元素个数
cin >> n;
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
}
// 读取查询数个数
int q;
cin >> q;
while (q--) {
cin >> x;
int L = 1, R = n, ans = -1;
// 二分查找
while (L <= R) {
int mid = (L + R) / 2;
if (a[mid] == x) {
ans = mid;
R = mid - 1; // 继续向左查找
} else if (a[mid] < x) {
L = mid + 1;
} else {
R = mid - 1;
}
}
// 输出结果
if (ans != -1) {
cout << ans << " ";
} else {
cout << -1 << " ";
}
}
return 0;
}