Problem Description

Read n words. Build frequency of each word. Then q queries of integer f. For each query, output how many distinct words have frequency exactly f.

Input Format

First line n. Next n lines words. Next line q. Next q lines f.

Output Format

q lines answers.

Sample Test Case

Input:
6 a a b c c c 3 1 2 3
Output:
1 1 1

Constraints

Total characters

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next