n = int( eval(input( )) )

s = [ int( val ) for val in input( ).split( " " ) ]

q = int( eval(input( )) )

t = [ int( val ) for val in input( ).split( " " ) ]



cnt = 0

cnt = 0

for ti in t:

	low = 0

	high = n - 1

	while low <= high:

		m = ( low+high )//2

		if ti < s[m]:

			high = m - 1

		elif s[m] < ti:

			low = m + 1

		else:

			cnt += 1

			break



print( cnt )
n = int( input( ) )

s = [ int( val ) for val in input( ).split( " " ) ]

q = int( input( ) )

t = [ int( val ) for val in input( ).split( " " ) ]



cnt = 0

cnt = 0

for ti in t:

	low = 0

	high = n - 1

	while low <= high:

		m = ( low+high )//2

		if ti < s[m]:

			high = m - 1

		elif s[m] < ti:

			low = m + 1

		else:

			cnt += 1

			break



print( cnt )
n = int(eval(input()))
s = [int(val) for val in input().split(" ")]
q = int(eval(input()))
t = [int(val) for val in input().split(" ")]
cnt = 0
cnt = 0
for ti in t:
    low = 0
    high = n - 1
    while low <= high:
        m = (low + high) // 2
        if ti < s[m]:
            high = m - 1
        elif s[m] < ti:
            low = m + 1
        else:
            cnt += 1
            break
print(cnt)

n = int(input())
s = [int(val) for val in input().split(" ")]
q = int(input())
t = [int(val) for val in input().split(" ")]
cnt = 0
cnt = 0
for ti in t:
    low = 0
    high = n - 1
    while low <= high:
        m = (low + high) // 2
        if ti < s[m]:
            high = m - 1
        elif s[m] < ti:
            low = m + 1
        else:
            cnt += 1
            break
print(cnt)

-n = int(eval(input())) +n = int(input()) -q = int(eval(input())) +q = int(input())