#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int shopCount;
  cin >> shopCount;
  int* prices = new int[100005];
  for (int i = 0; i < 100005; i++) {
    prices[i] = 0;
  }
  for (int i = 0; i < shopCount; i++) {
    int tmp;
    cin >> tmp;
    prices[tmp]++;
  }
  for (int i = 1; i < 100005; i++) {
    prices[i] += prices[i - 1];
  }
  int days;
  cin >> days;
  for (int i = 0; i < days; i++) {
    int coins;
    cin >> coins;
    if (coins > 100000) {
      cout << shopCount << endl;
    } else {
      cout << prices[coins] << endl;
    }
  }
  return 0;
}
