fork download
  1. # your code goes here
  2. from collections import defaultdict
  3. n = int(input())
  4.  
  5. map = defaultdict(int)
  6.  
  7. for i in range(n):
  8. num = int(input())
  9. map[num]+=1
  10.  
  11. q = int(input())
  12.  
  13. for i in range(0, q):
  14. query = int(input())
  15. print(map[query])
  16.  
Success #stdin #stdout 0.11s 14116KB
stdin
3      
99     
-5     
99     
2       
99     
-5    
stdout
2
1