#include<iostream>
#include<algorithm>
using namespace std;
const int M = 100010;
int a[M];
int vis[M];
int main(){
int n;
cin >> n;
for(int i = 1 ; i <= n ; i++){
cin >>a[i];
vis[a[i]] = i;
}
sort(a+1,a+n+1);
int op;
cin >> op;
while(op--){
int temp;
cin >> temp;
int l = 1 , r = n;
while(l < r){
int mid = (l+r) /2;
if(a[mid] < temp) l = mid + 1;
else {
r = mid;
}
}
if(a[l] == temp) cout << vis[a[l]] << endl;
else cout << "0\n";
}
}