#include using namespace std; map mutants; int main() { freopen("mutants.in", "r", stdin); freopen("mutants.out", "w", stdout); int n, m, temp; cin >> n; for(int i = 0; i < n; i++) { cin >> temp; if(mutants.find(temp) != mutants.end()) { mutants[temp]++; } else { mutants[temp] = 1; } } cin >> m; for(int i = 0; i < m; i++) { cin >> temp; if(mutants.find(temp) != mutants.end()) { cout << mutants[temp]; } else { cout << 0; } cout << endl; } return 0; }