#include <bits/stdc++.h>
using namespace std;
int main() {
  int num_shop;
  cin >> num_shop;
  vector<int> price(num_shop);
  map<int, int> M;
  for (int i = 0; i < num_shop; i++) {
    cin >> price[i];
    M[price[i]]++;
  }
  sort(price.begin(), price.end());
  int num_day;
  cin >> num_day;
  for (int i = 0; i < num_day; i++) {
    int money;
    cin >> money;
    auto it2 = upper_bound(price.begin(), price.end(), money);
    int count;
    if (money < price[0])
      count = 0;
    else if (money >= price[num_shop - 1])
      count = num_shop;
    else
      count = it2 - price.begin();
    cout << count << endl;
  }
  return 0;
}
