#include <bits/stdc++.h>
using namespace std;
int main() {
  int num_of_shops;
  cin >> num_of_shops;
  vector<int> shops(num_of_shops);
  for (int i = 0; i < num_of_shops; i++) cin >> shops[i];
  sort(shops.begin(), shops.end());
  int days;
  cin >> days;
  while (days--) {
    int money;
    cin >> money;
    cout << upper_bound(shops.begin(), shops.end(), money) - shops.begin()
         << endl;
  }
  return 0;
}
