Ready, (Set), Go!

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

Christmas was fast-approaching, and Santa's elves were on their last batch of presents... or so they thought. It was two days before Christmas Eve, and Santa had just realized his master spreadsheet wasn't updated to include the children whose letters to the North Pole got delayed!

It's now just 6 hours before Santa must leave to go deliver presents all around the world, yet Santa still hasn't confirmed if every child's present has been loaded onto his sleigh.

He's been going through every child on his updated spreadsheet, then searching through every present on his sleigh to see if there's a present for that child. However, with hundreds of thousands of children and presents, this has taken him hours and he still isn't even halfway done. Actually, the sheer number of presents hasn't even been the worst part; only some of Santa's elves have been capitalizing the first letter of each child's name.

Thus, Santa has hired you to complete this task. You work with one of Santa's elves, who goes through every present on the sleigh and tells you the name of the child each present is going to (multiple presents may be going to the same child). Cross-referencing with Santa's spreadsheet, can you determine how many children do not yet have a present packaged and loaded onto Santa's sleigh?

Constraints

1 \le N, M \le 10^5

Input Specification

The first line of input contains the number of presents on the sleigh, N.

The next N lines contain the name of the child each present is going to (multiple presents may be going to the same child).

The next line of input contains the number of children in the spreadsheet, M.

The last M lines contain the names of the children in the spreadsheet (No two children have the same name).

Output Specification

Output the number of children who do not yet have a present packaged and loaded onto Santa's sleigh.

Sample Input

5
aaron zhu
Ethan Zhu
Aaron Zhu
shane chen
Max Sun
5
Daniel Ye
Max Sun
Ethan Zhu
Aaron Zhu
Shane Chen

Sample Output

1

Sample Explanation

Only Daniel Ye does not have a present on the sleigh.


Comments

There are no comments at the moment.