#include <bits/stdc++.h>
using namespace std;
int ara[100000 + 7], i = 0;
int b_s(int n) {
  int temp;
  int l = 0, h = i;
  while (l < h) {
    int mid = l + (h - l) / 2;
    if (ara[mid] > n) {
      temp = mid - 1;
      h = mid;
    } else {
      temp = mid;
      l = mid + 1;
    }
  }
  return temp;
}
int main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    scanf("%d", &ara[i]);
    i++;
  }
  sort(ara, ara + i);
  int q;
  scanf("%d", &q);
  int temp;
  while (q--) {
    scanf("%d", &temp);
    int ans = b_s(temp);
    printf("%d\n", ans + 1);
  }
  return 0;
}
