/**
* Author : Shafi
*
***/
#include <iostream>
#include "vector"
#include "set"
#include "algorithm"
using namespace std;
#define ll long long int
int main() {
// Write C++ code here
int n,m;
cin>>n;
vector<ll>v(n);
vector<ll>combined;
for(auto &it:v){
cin>>it;
combined.push_back(it);
}
cin>>m;
vector<ll>vv(m);
for(auto &it:vv){
cin>>it;
combined.push_back(it);
}
sort(combined.rbegin(),combined.rend());
vector<ll>ans;
set<ll>st;
int j = 0;
for(int i=0;i<m;i++){
auto ite = find(combined.begin(),combined.end(),vv[i]);
int idx;
if(ite != combined.end()){
idx = ite - combined.begin();
if(!st.count(idx)) st.insert(idx);
else{
idx++;
st.insert(idx);
}
}
int cnt = count(v.begin(),v.end(),vv[i]);
ans.push_back(cnt+idx+1+j);
}
for(auto it:ans){
cout<<it<<" ";
}
cout<<endl;
return 0;
}