#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
using namespace std;
bool compare(const tuple<int, int, int>& a, const tuple<int, int, int>& b) {
if (get<0>(a) != get<0>(b)) // Compare first elements
return get<0>(a) > get<0>(b); // If not equal, return comparison result
if (get<1>(a) != get<1>(b)) // If first elements are equal, compare second elements
return get<1>(a) < get<1>(b); // If not equal, return comparison result
return get<2>(a) < get<2>(b); // If both first and second elements are equal, compare third elements
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
long long t;
//cin >> t;
t = 1;
while (t--) {
long long n;
cin >> n;
long long a[n];
for (long long i = 0; i < n; i++) {
cin >> a[i];
}
long long m;
cin >> m;
long long b[m];
for (long long i = 0; i < m; i++) {
cin >> b[i];
}
vector<tuple<long long, long long, long long>> v;
for (long long i = 0; i < n; i++) {
v.push_back({a[i], 1, i});
}
for (long long i = 0; i < m; i++) {
v.push_back({b[i], 2, i});
}
sort(v.begin(), v.end(), compare);
long long p[m];
for (long long i = 0; i < m + n; i++) {
if (get<1>(v[i]) == 2)
p[get<2>(v[i])] = i;
}
for (long long i = 0; i < m; i++) {
cout << p[i]+1 << " ";
}
}
return 0;
}