Under construction

Still being built. Things may change

Passport Checking

Interview

Time limit1sMemory limit64 MB

Summary
Count how many passport numbers on a check list appear in a list of stolen numbers, counting duplicates each time.
Level

Easy3 of 10

Topics
Hash map, String
Solved
No attempts yet

Problem

This task comes from the MH370 stolen passport case.

The Interpol database holds NN passport numbers reported stolen. You are given MM more passport numbers to check. Count how many of the numbers on the check list were reported stolen.

Input

The first line contains an integer NN. (1≤N≤1000001 \le N \le 100000)

Each of the next NN lines contains one passport number reported stolen.

The next line contains an integer MM. (1≤M≤1000001 \le M \le 100000)

Each of the next MM lines contains one passport number to check.

Passport numbers consist of letters and digits only and have length at most 15. Uppercase and lowercase letters are different characters.

Output

Print on the first line how many of the MM passport numbers to check were reported stolen. If the same number appears several times on the check list, count it once for every appearance.

Examples2

  1. Example 1

    Input
    10
    I220232074
    D327045452
    L261687170
    H720628600
    T181830847
    I108428623
    J316167657
    M520837168
    H364436380
    J531555744
    5
    U133207838
    D327045452
    S374500074
    U882158042
    H364436380
    
    Expected output
    2
    
  2. Example 2

    Input
    1
    A1
    1
    A1
    
    Expected output
    1