// BISMILLAH
#include "bits/stdc++.h"
#define fastIO std::ios::sync_with_stdio(0);std::cin.tie(0)
#define ll long long int
#define flush fflush(stdout)
// #define int ll
using pii = std::pair<int,int>;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int mxN = 500005, inf = 1000000005;
signed main() {
// fastIO;
int testCases=1;
// scanf("%lld",&testCases);
// std::cin >> testCases;
for (int T = 1; T <= testCases; T++) {
int N;
scanf("%d", &N);
std::vector<int> a(N);
for (auto &i : a) scanf("%d",&i);
sort(a.begin(), a.end());
std::vector<pii> al;
scanf("%d", &N);
for (int i = 0,x; i < N; i++) {
scanf("%d", &x);
al.push_back({x, i});
}
sort(al.begin(), al.end(), [](pii a, pii b){
if (a.first == b.first) return a.second < b.second;
return a.first > b.first;
});
int ans[N];
for (auto i : al) {
int cur = i.first;
auto it = lower_bound(a.begin(), a.end(), cur);
int pos = a.end() - it + 1;
ans[i.second] = pos;
a.push_back(inf);
}
for (int i = 0; i < N; i++) {
printf("%d ", ans[i]);
}
}
return 0;
}
/*
*/