#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main () {
cin.tie(0)->sync_with_stdio(0);
int t = 1;
///cin >> t;
while (t--) {
vector<pair<int,int>>v;
int n, m;
cin >> n;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
v.push_back({x,INT_MAX});
}
cin >> m;
int ans[m]{};
for (int i = 0; i < m; i++) {
int x;
cin >> x;
v.push_back({x,-i});
}
sort (v.rbegin(), v.rend());
for (int i = 0; i < v.size(); i++) {
if (v[i].second == INT_MAX) continue;
ans[-1*v[i].second] = i+1;
}
for (int i = 0; i < m; i++) {
cout << ans[i] << ' ';
}
cout << '\n';
}
}