def binarySearch(A, key, n):

    left = 0

    right = n

    while left < right:

        mid = (left + right) // 2

        if S[mid] == i:

            return True

        elif i < S[mid]:

            right = mid

        else:

            left = mid + 1

    return False



n = int(eval(input()))

S = tuple(map(int, input().split(' ')))



q = eval(input())

T = tuple(map(int, input().split(' ')))



cnt = 0



for i in T:

    if binarySearch(S, i, n):

        cnt += 1



print(cnt)
def binarySearch(A, key, n):

    left = 0

    right = n

    while left < right:

        mid = (left + right) // 2

        if A[mid] == key:

            return True

        elif key < A[mid]:

            right = mid

        else:

            left = mid + 1

    return False



n = int(eval(input()))

S = tuple(map(int, input().split(' ')))



q = eval(input())

T = tuple(map(int, input().split(' ')))



cnt = 0



for i in T:

    if binarySearch(S, i, n):

        cnt += 1



print(cnt)
def binarySearch(A, key, n):
    left = 0
    right = n
    while left < right:
        mid = (left + right) // 2
        if S[mid] == i:
            return True
        elif i < S[mid]:
            right = mid
        else:
            left = mid + 1
    return False


n = int(eval(input()))
S = tuple(map(int, input().split(" ")))
q = eval(input())
T = tuple(map(int, input().split(" ")))
cnt = 0
for i in T:
    if binarySearch(S, i, n):
        cnt += 1
print(cnt)

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


n = int(eval(input()))
S = tuple(map(int, input().split(" ")))
q = eval(input())
T = tuple(map(int, input().split(" ")))
cnt = 0
for i in T:
    if binarySearch(S, i, n):
        cnt += 1
print(cnt)

-        if S[mid] == i: +        if A[mid] == key: -        elif i < S[mid]: +        elif key < A[mid]: