#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
unsigned int n;
cin >> n;
int* A = new int[n];
for (int i = 0; i < n; i++)
{
cin >> A[i];
}
sort(A, A + n);
int m;
cin >> m;
int x = m;
int* B = new int[m];
for (int i = 0; i < m; i++)
{
cin >> B[i];
}
int f = 250000;
int* V = new int[f];
for (int i = 0; i <m; i++)
{
int L = -1;
int R = n;
while (R - L > 1)
{
m = (R + L) / 2;
if (A[m] < B[i])
{
L = m;
}
else
{
R = m;
}
}
V[i] = R;
}
for (int i = 0; i < x; i++)
{
cout << V[i] << " ";
}
}