def linearSearch(key, list, N):

    list[N] = key

    i = 0

    while list[i] != key:

        i += 1

    return int(i != N)





N1 = int(eval(input()))

arr1 = [int(n) for n in input().split()] + [0]

N2 = int(eval(input()))

arr2 = [int(n) for n in input().split()]



print((sum([linearSearch(key, arr1, N1) for key in arr2])))



def linearSearch(key, list):

    for e in list:

        if key == e:

            return 1

    return 0





N1 = int(eval(input()))

arr1 = [int(n) for n in input().split()]

N2 = int(eval(input()))

arr2 = [int(n) for n in input().split()]



print((sum([linearSearch(key, arr1) for key in arr2])))



def linearSearch(key, list, N):
    list[N] = key
    i = 0
    while list[i] != key:
        i += 1
    return int(i != N)


N1 = int(eval(input()))
arr1 = [int(n) for n in input().split()] + [0]
N2 = int(eval(input()))
arr2 = [int(n) for n in input().split()]
print((sum([linearSearch(key, arr1, N1) for key in arr2])))

def linearSearch(key, list):
    for e in list:
        if key == e:
            return 1
    return 0


N1 = int(eval(input()))
arr1 = [int(n) for n in input().split()]
N2 = int(eval(input()))
arr2 = [int(n) for n in input().split()]
print((sum([linearSearch(key, arr1) for key in arr2])))

-def linearSearch(key, list, N): -    list[N] = key -    i = 0 -    while list[i] != key: -        i += 1 -    return int(i != N) +def linearSearch(key, list): +    for e in list: +        if key == e: +            return 1 +    return 0 -arr1 = [int(n) for n in input().split()] + [0] +arr1 = [int(n) for n in input().split()] -print((sum([linearSearch(key, arr1, N1) for key in arr2]))) +print((sum([linearSearch(key, arr1) for key in arr2])))