#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
void solve() {
  int n;
  cin >> n;
  int x[n];
  for (int i = 0; i < n; ++i) {
    cin >> x[i];
  }
  int Nc;
  cin >> Nc;
  int coins[Nc];
  for (int i = 0; i < Nc; ++i) {
    cin >> coins[i];
  }
  sort(x, x + n);
  for (int i = 0; i < Nc; ++i) {
    cout << (upper_bound(x, x + n, coins[i])) - x << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  solve();
  return 0;
}
