N = int(eval(input()))

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

Q = int(eval(input()))

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



def binary_search(target_num, head, tail):

    while head <= tail:

        idx = int((head+tail)/2)

        if target_num == S[idx]:

            return True

        elif target_num < S[idx]:

            tail = idx - 1

        else:

            head = idx + 1

    return False





match_count = 0

for target_num in T:

    if binary_search(target_num, 0, len(S)-1):

        match_count += 1



print((str(match_count)))

N = int(eval(input()))

S = set(input().split())

Q = int(eval(input()))

T = set(input().split())

print((len(S & T)))

N = int(eval(input()))
S = list(map(int, input().split()))
Q = int(eval(input()))
T = list(map(int, input().split()))


def binary_search(target_num, head, tail):
    while head <= tail:
        idx = int((head + tail) / 2)
        if target_num == S[idx]:
            return True
        elif target_num < S[idx]:
            tail = idx - 1
        else:
            head = idx + 1
    return False


match_count = 0
for target_num in T:
    if binary_search(target_num, 0, len(S) - 1):
        match_count += 1
print((str(match_count)))

N = int(eval(input()))
S = set(input().split())
Q = int(eval(input()))
T = set(input().split())
print((len(S & T)))

-S = list(map(int, input().split())) +S = set(input().split()) -T = list(map(int, input().split())) - - -def binary_search(target_num, head, tail): -    while head <= tail: -        idx = int((head + tail) / 2) -        if target_num == S[idx]: -            return True -        elif target_num < S[idx]: -            tail = idx - 1 -        else: -            head = idx + 1 -    return False - - -match_count = 0 -for target_num in T: -    if binary_search(target_num, 0, len(S) - 1): -        match_count += 1 -print((str(match_count))) +T = set(input().split()) +print((len(S & T)))