#include <bits/stdc++.h>
using namespace std;
int temp;
int maxN = -1;
int main() {
  int n;
  cin >> n;
  int arr[100001] = {0};
  while (n--) {
    cin >> temp;
    arr[temp]++;
    maxN = max(temp, maxN);
  }
  int s = 0;
  for (int m = 0; m <= maxN; m++) {
    s += arr[m];
    arr[m] = s;
  }
  int q;
  cin >> q;
  while (q--) {
    cin >> temp;
    if (temp >= maxN)
      cout << arr[maxN];
    else
      cout << arr[temp];
    cout << endl;
  }
  return 0;
}
