You are given a sequence of _n_ integers S and a sequence of different _q_ integers T. Write a program which outputs C, the number of integers in T which are also in the set S.
n = int(input())
S = list(map(int, input().split()))

n = int(input())
T = list(map(int, input().split()))
cnt = 0

for i in T:
    left = 0
    right = len(S)-1
    center = int( (left+right) / 2 )

    while center >= left and center <= right:
        if S[center] == i:
            cnt += 1
            break
        elif S[center] > i:
            right = center-1
            center = int( (left+right) / 2 )
        elif S[center] < i:
            left = center-1
            center = int( (left+right) / 2 )

print(cnt)

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

n = int(input())
T = list(map(int, input().split()))
cnt = 0

for i in T:
    left = 0
    right = len(S)-1
    center = int( (left+right) / 2 )

    while center >= left and center <= right:
        if S[center] == i:
            cnt += 1
            break
        elif S[center] > i:
            right = center-1
            center = int( (left+right) / 2 )
        elif S[center] < i:
            left = center+1
            center = int( (left+right) / 2 )

print(cnt)

