https://www.acmicpc.net/problem/10816
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define int int64_t
using namespace std;
int32_t main() {
fastio;
int n,m; cin >> n;
vector<int> a(n);
for(int i = 0; i < n; i++) cin >> a[i];
sort(a.begin(), a.end());
cin >> m;
for(int i = 0; i < m; i++){
int t; cin >> t;
cout << (upper_bound(a.begin(), a.end(), t) - lower_bound(a.begin(), a.end(), t)) << " ";
}
return 0;
}