#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define endl '\n'
#define Endl '\n'
using namespace std;
const int N = 2e5 + 5;
int tc, n, m;
vector<pair<int, int>> results;
bool cmp(pair<int, int> a, pair<int, int> b) {
if (a.F == b.F) {
return a.S < b.S;
} else {
return a.F > b.F;
}
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); // cout.tie(0);
cin >> n;
for (int i = 1; i <= n; i++) {
int x;
cin >> x;
results.push_back({x, -1});
}
cin >> m;
for (int i = 1; i <= m; i++) {
int x;
cin >> x;
results.push_back({x, i});
}
vector<int> Ans(m);
int cnt = 0;
sort(results.begin(), results.end(), cmp);
for (auto i : results) {
++cnt;
if (i.S != -1) {
Ans[i.S - 1] = cnt;
}
}
for (int i = 0; i < m; i++) {
if (i) {
cout << " ";
}
cout << Ans[i];
}
return 0;
}