fork download
  1. # your code goes here
  2. from collections import defaultdict
  3. n=int(input())
  4. array=[]
  5. hashmap=defaultdict(int)
  6. for i in range(n):
  7. num=int(input())
  8. array.append(num)
  9. hashmap[num]+=1
  10. q=int(input())
  11. for i in range(q):
  12. query=int(input())
  13. count=hashmap[query]
  14. print(count)
Success #stdin #stdout 0.07s 14192KB
stdin
5
1 
1 
1 
1 
1 
1
1
stdout
5