#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> x, cost;
  for (int i = 0; i < n; i++) {
    int no;
    cin >> no;
    x.push_back(no);
  }
  sort(x.begin(), x.end());
  int q;
  cin >> q;
  while (q--) {
    int cost, j;
    cin >> cost;
    j = upper_bound(x.begin(), x.end(), cost) - x.begin();
    cout << j << endl;
  }
}
