def main():

    N = int(eval(input()))

    S = [int(_) for _ in input().split()]

    Q = int(eval(input()))

    T = [int(_) for _ in input().split()]



    ans = 0



    for t in T:

        for s in S:

            if s == t:

                ans += 1

                break



    print(ans)



main()



import sys



# Set max recursion limit

sys.setrecursionlimit(1000000)





def li_input():

    return [int(_) for _ in input().split()]





def main():

    n = int(eval(input()))

    S = li_input()

    q = int(eval(input()))

    T = li_input()



    ans = 0



    for t in T:

        if t in S:

            ans += 1



    print(ans)





main()



def main():
    N = int(eval(input()))
    S = [int(_) for _ in input().split()]
    Q = int(eval(input()))
    T = [int(_) for _ in input().split()]
    ans = 0
    for t in T:
        for s in S:
            if s == t:
                ans += 1
                break
    print(ans)


main()

import sys

# Set max recursion limit
sys.setrecursionlimit(1000000)


def li_input():
    return [int(_) for _ in input().split()]


def main():
    n = int(eval(input()))
    S = li_input()
    q = int(eval(input()))
    T = li_input()
    ans = 0
    for t in T:
        if t in S:
            ans += 1
    print(ans)


main()

+import sys + +# Set max recursion limit +sys.setrecursionlimit(1000000) + + +def li_input(): +    return [int(_) for _ in input().split()] + + -    N = int(eval(input())) -    S = [int(_) for _ in input().split()] -    Q = int(eval(input())) -    T = [int(_) for _ in input().split()] +    n = int(eval(input())) +    S = li_input() +    q = int(eval(input())) +    T = li_input() -        for s in S: -            if s == t: -                ans += 1 -                break +        if t in S: +            ans += 1