• + 0 comments
    s1 = [input().strip() for _ in range(int(input()))]
    [print(s1.count(input().strip())) for _ in range(int(input()))]