#include <bits/stdc++.h>
using namespace std;
int binary_search(int arr[], int l, int h, int x) {
  while (l <= h) {
    int mid = (l + h) / 2;
    if (arr[mid] <= x)
      l = mid + 1;
    else
      h = mid - 1;
  }
  return h;
}
void countEleLessThanOrEqual(int arr1[], int arr2[], int m, int n) {
  sort(arr2, arr2 + n);
  for (int i = 0; i < m; i++) {
    int index = binary_search(arr2, 0, n - 1, arr1[i]);
    cout << (index + 1) << " " << endl;
  }
}
int main() {
  int n;
  cin >> n;
  int x[n];
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  sort(x, x + n);
  int q;
  cin >> q;
  int d[q];
  for (int i = 0; i < q; i++) {
    cin >> d[i];
  }
  countEleLessThanOrEqual(d, x, q, n);
  return 0;
}
