#include<bits/stdc++.h>
using namespace std;
const long long M=2e5+10,MOD=1000000007;
typedef long long ll;
bool cmp(pair<int,int>x,pair<int,int>y){
if(x.first!=y.first){
return x.first>y.first;
}
else return x.second<y.second;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n,m;
cin>>n;
vector<pair<int,int>>v;
for(int i=1;i<=n;i++){
int a;
cin>>a;
v.push_back({a,i});
}
cin>>m;
for(int i=1;i<=m;i++){
int a;
cin>>a;
v.push_back({a,i+n});
}
sort(v.begin(),v.end(),cmp);
vector<int>res(m+1,0);
int pos=1;
for(auto it:v){
if(it.second>n)res[it.second-n]=pos;
pos++;
// cout<<it.first<<" "<<it.second<<"\n";
}
for(int i=1;i<=m;i++)cout<<res[i]<<" ";
return 0;
}