eolymp
bolt
Try our new interface for solving problems
Problems

New Year

New Year

New Year in the Rabbitland surprisingly comes in April, and also in June, September, and December. Last new year rabbits Bryan and Stew received a lot of candies. They’ve collected all their candies into \textbf{2} boxes and want to find how many different kinds of candies they have together in boxes of Stew and Bryan. \InputFile The first line of the input contains two integers, separated by space: \textbf{N}, \textbf{M} (\textbf{1} ≤ \textbf{N}, \textbf{M} ≤ \textbf{1000}). The second line contains \textit{N} names of candies from the Stew's box, separated by spaces, while the third line contains \textbf{M} names of candies from the Bryan's box. Each candy name consists of not more than twenty letter (lowercase '\textbf{a}' to '\textbf{z}'), and not less than one. \OutputFile You need to output one integer -- number of different kinds of candies that are available both boxes together.
Time limit 1 second
Memory limit 64 MiB
Input example #1
5 5
snikers murs skitless murs murs
baunti snikers baunti murs murs
Output example #1
2
Source ACM-ICPC Ukraine 2012, 1st Stage Ukraine, April 21, 2012