#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
/*int t;
cin >> t;
while (t--){*/
int n, m;
cin >> n;
vector<pair<int, pair<int, int>>> a(n);
for (int i = 0; i < n; i++){
int x;
cin >> x;
a[i].first = -x;
a[i].second.first = i + 1;
a[i].second.second = 1;
}
cin >> m;
map<int, int> mp;
for (int i = 0; i < m; i++){
int x;
cin >> x;
mp[n + i + 1] = 0;
a.push_back({-x, {n + i + 1, 0}});
}
sort(a.begin(), a.end());
for (int i = 0; i < n + m; i++){
if (a[i].second.second == 0){
mp[a[i].second.first] = i + 1;
}
}
for (auto [f, s] : mp){
cout << s << ' ';
}
//}
}