ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

USU Junior Championship March'2002

About     Problems     Submit solution     Judge status     Standings
Contest is over

G. History Exam

Time limit: 1.5 second
Memory limit: 64 MB
Professor of history decided to simplify the examination process. At the exam, every student should write a list of historic dates she knows (she should write the years only and, of course, must be able to explain what event took place in this or that year). Professor has a list of dates that students must know. In order to decide upon the student's mark, Professor counts the number of dates in the student's list that are also present in his list. The student gets her mark according to the number of coincidences.
Your task is to automatize this process. Write a program that would count the number of dates in the student's list that also occur in Professor's list.

Input

The first line contains the number N of dates in Professor's list, 1 ≤ N ≤ 15000. The following N lines contain this list, one number per line. Each date is a positive integer not exceeding 109. Professor's list is sorted in non-descending order. The following line contains the number M of dates in the student's list, 1 ≤ M ≤ 106. Then there is the list itself; it is unsorted. The dates here satisfy the same restriction. Both in Professor's and in the student's lists dates can appear more than once.

Output

Output the number of dates in the student's that are also contained in Professor's list.

Sample

inputoutput
2
1054
1492
4
1492
65536
1492
100
2
Problem Author: folklore
Problem Source: Fifth High School Children Programming Contest, Ekaterinburg, March 02, 2002
To submit the solution for this problem go to the Problem set: 1196. History Exam