fork download
  1.  
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. int n; cin>>n;
  7. unordered_map<int,int> mp;
  8. for(int i=0;i<n;i++){
  9. int temp; cin>>temp;
  10. mp[temp]++;
  11.  
  12. }
  13. int q; cin>>q;
  14. while(q--){
  15.  
  16.  
  17. int f; cin>>f;
  18. cout<<mp[f]<<endl;
  19.  
  20.  
  21. }
  22. }
  23.  
Success #stdin #stdout 0s 5316KB
stdin
5
1 1 1 1 1
3
1 2 3
stdout
5
0
0