#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
void solve(){
int n, m; cin>>n;//>>m;
//cout<<n<<m<<"\n";
vector<pair<int, int>> v;
for(int i=0; i<n; i++){
int x; cin>>x;
v.push_back({-x, 0});
}
cin>>m;
for(int i=0; i<m; i++){
int x; cin>>x;
v.push_back({-x, i+1});
}
int pos[m+1];
sort(v.begin(), v.end());
//for(auto p: v) cout<<p.first<<" "<<p.second<<"\n";
for(int i=0; i<n+m; i++){
pos[v[i].second] = i+1;
}
for(int i=1; i<=m; i++){
cout<<pos[i]<<" ";
}
//cout<<"\n";
return;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t=1; //cin>>t;
while(t--){
solve();
}
return 0;
}