#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
#define __MY_TEST__ 0
struct node
{
int first,second;
bool operator <(const node &other) const
{
return first<other.first;
}
}a[100005];
signed main(){
#if __MY_TEST__
freopen(".in","r",stdin);
freopen(".out","w",stdout);
#endif
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i].first;
a[i].second=i;
}
sort(a+1,a+n+1);
int m;
cin>>m;
for(int i=1;i<=m;i++)
{
int s;
cin>>s;
int l=1,r=n;
bool flag=0;
while(l<=r)
{
int mid=(l+r)>>1;
if(a[mid].first==s)
{
cout<<a[mid].second<<endl;
flag=1;
break;
}
if(a[mid].first<s)
{
l=mid+1;
}
else
{
r=mid-1;
}
}
if(flag==0)
{
cout<<0<<endl;
}
}
#if __MY_TEST__
fclose(stdin);
fclose(stdout);
#endif
}