#include <bits/stdc++.h>
using namespace std;
int n, m, lev[100086];
int cmp(int a, int b) { return a > b; }
int erfen(int t, int w, int k) {
  int i, j, mid;
  mid = (t + w) / 2;
  if (t == w) return t;
  if (lev[mid] <= k) {
    return erfen(t, mid, k);
  }
  if (lev[mid] > k) {
    return erfen(mid + 1, w, k);
  }
}
int main() {
  int i, j, k, wei;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &lev[i]);
  }
  sort(lev, lev + n, cmp);
  scanf("%d", &m);
  for (i = 1; i <= m; i++) {
    scanf("%d", &k);
    wei = erfen(0, n - 1, k);
    if (lev[wei] <= k) {
      while (lev[wei] <= k) {
        wei--;
        if (wei <= 0) break;
      }
    }
    printf("%d\n", n - wei - 1);
  }
  return 0;
}
