#include <bits/stdc++.h>
using namespace std;
long long binarysearch(long long l, long long r, long long key,
                       long long price[]) {
  long long mid = 0;
  while (l <= r) {
    mid = (l + r) / 2;
    if (price[mid] <= key) {
      l = mid + 1;
    } else if (price[mid] > key) {
      r = mid - 1;
    }
  }
  return r;
}
int main() {
  long long n, q, price[100003], i, j;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> price[i];
  }
  cin >> q;
  sort(price, price + n);
  for (i = 0; i < q; i++) {
    cin >> j;
    cout << binarysearch(0, n - 1, j, price) + 1 << endl;
  }
  return 0;
}
