def binary_search(S, n, index ):

    if S[index] == n:

        return 'eq'

    elif S[index] < n:

        return 'bt'

    elif S[index] > n:

        return 'lt'



n = int(eval(input()))

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

q = int(eval(input()))

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



cnt = 0

for i in T:

    mini = 0

    maxi = len(S) - 1

    while int(maxi - mini) >= 0:

        index = int( (mini + maxi) / 2 )

        rs = binary_search(S, i, index )

        if rs == 'eq':

            cnt += 1

            break

        elif rs == 'bt':

            mini = index + 1

        elif rs == 'lt':

            maxi = index - 1



print(cnt)
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):

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

    if target_num == S[idx]:

        return True

    elif target_num < S[idx]:

        if head == idx:

            return False

        return binary_search(target_num, head, idx-1)

    else:

        if tail == idx:

            return False

        return binary_search(target_num, idx+1, tail)





match_count = 0

for target_num in T:

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

        match_count += 1



print((str(match_count)))

def binary_search(S, n, index):
    if S[index] == n:
        return "eq"
    elif S[index] < n:
        return "bt"
    elif S[index] > n:
        return "lt"


n = int(eval(input()))
S = [int(i) for i in input().split()]
q = int(eval(input()))
T = [int(i) for i in input().split()]
cnt = 0
for i in T:
    mini = 0
    maxi = len(S) - 1
    while int(maxi - mini) >= 0:
        index = int((mini + maxi) / 2)
        rs = binary_search(S, i, index)
        if rs == "eq":
            cnt += 1
            break
        elif rs == "bt":
            mini = index + 1
        elif rs == "lt":
            maxi = index - 1
print(cnt)

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):
    idx = int((head + tail) / 2)
    if target_num == S[idx]:
        return True
    elif target_num < S[idx]:
        if head == idx:
            return False
        return binary_search(target_num, head, idx - 1)
    else:
        if tail == idx:
            return False
        return binary_search(target_num, idx + 1, tail)


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

-def binary_search(S, n, index): -    if S[index] == n: -        return "eq" -    elif S[index] < n: -        return "bt" -    elif S[index] > n: -        return "lt" +N = int(eval(input())) +S = list(map(int, input().split())) +Q = int(eval(input())) +T = list(map(int, input().split())) -n = int(eval(input())) -S = [int(i) for i in input().split()] -q = int(eval(input())) -T = [int(i) for i in input().split()] -cnt = 0 -for i in T: -    mini = 0 -    maxi = len(S) - 1 -    while int(maxi - mini) >= 0: -        index = int((mini + maxi) / 2) -        rs = binary_search(S, i, index) -        if rs == "eq": -            cnt += 1 -            break -        elif rs == "bt": -            mini = index + 1 -        elif rs == "lt": -            maxi = index - 1 -print(cnt) +def binary_search(target_num, head, tail): +    idx = int((head + tail) / 2) +    if target_num == S[idx]: +        return True +    elif target_num < S[idx]: +        if head == idx: +            return False +        return binary_search(target_num, head, idx - 1) +    else: +        if tail == idx: +            return False +        return binary_search(target_num, idx + 1, tail) + + +match_count = 0 +for target_num in T: +    if binary_search(target_num, 0, len(S) - 1): +        match_count += 1 +print((str(match_count)))