n = int(eval(input()))

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

m = int(eval(input()))

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

cnt = 0



for i in li2:

	if i in li1:

		cnt +=1

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

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

q = int(eval(input()))

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



sum = 0



for i in T:

    if i in S:

        sum +=1

        

print(sum)
n = int(eval(input()))
li1 = list(map(int, input().split()))
m = int(eval(input()))
li2 = list(map(int, input().split()))
cnt = 0
for i in li2:
    if i in li1:
        cnt += 1
print(cnt)

n = int(eval(input()))
S = set(map(int, input().split()))
q = int(eval(input()))
T = list(map(int, input().split()))
sum = 0
for i in T:
    if i in S:
        sum += 1
print(sum)

-li1 = list(map(int, input().split())) -m = int(eval(input())) -li2 = list(map(int, input().split())) -cnt = 0 -for i in li2: -    if i in li1: -        cnt += 1 -print(cnt) +S = set(map(int, input().split())) +q = int(eval(input())) +T = list(map(int, input().split())) +sum = 0 +for i in T: +    if i in S: +        sum += 1 +print(sum)