def binarySearch(key):

    left = 0

    right = n

    while left < right:

        mid = (left + right) // 2

        if key == A[mid]: return 1

        if key > A[mid]: left = mid + 1

        elif key < A[mid]: right = mid

    return 0



n = int(eval(input()))

A = list(map(int,input().split()))

eval(input())

print((sum(binarySearch(e) for e in map(int,input().split()))))

import bisect

n = int(eval(input()))

A = list(map(int, input().split()))

eval(input())

k = 0

for e in map(int, input().split()):

    i = bisect.bisect_left(A, e)

    if i < n and A[i] == e: k += 1 

print(k)

def binarySearch(key):
    left = 0
    right = n
    while left < right:
        mid = (left + right) // 2
        if key == A[mid]:
            return 1
        if key > A[mid]:
            left = mid + 1
        elif key < A[mid]:
            right = mid
    return 0


n = int(eval(input()))
A = list(map(int, input().split()))
eval(input())
print((sum(binarySearch(e) for e in map(int, input().split()))))

import bisect

n = int(eval(input()))
A = list(map(int, input().split()))
eval(input())
k = 0
for e in map(int, input().split()):
    i = bisect.bisect_left(A, e)
    if i < n and A[i] == e:
        k += 1
print(k)

-def binarySearch(key): -    left = 0 -    right = n -    while left < right: -        mid = (left + right) // 2 -        if key == A[mid]: -            return 1 -        if key > A[mid]: -            left = mid + 1 -        elif key < A[mid]: -            right = mid -    return 0 - +import bisect -print((sum(binarySearch(e) for e in map(int, input().split())))) +k = 0 +for e in map(int, input().split()): +    i = bisect.bisect_left(A, e) +    if i < n and A[i] == e: +        k += 1 +print(k)